Closed maybeec closed 9 years ago
Thanks for the feedback. Actually dealing with accessors is quite an advanced use-case. There is a high-level API with e.g. PojoDescriptor.getProperty(POJO pojo, String property)
The accessors need to have different types for generic correctness and interleaving. However, it might be a good idea for 1. to have a central type offering all available modes (the idea was that modes can also be implemented outside mmm-util-core and plugged into for really advanced use-cases) or at least for 2. to list them in the javadoc. I think already 1. is a good option and would also solve 2.
Adding the available constants to PojoPropertyAccessorMode would be intuitive for first view of API users. However, this is sick as the constants would be inherited by all subclasses so every extended mode class would have them and mix arbitrary modes together and also shadow the ones it actually defines. The only reasonable way to address this is IMHO to add a new type PojoPropertyAccessorModes in the same package defining all the constants in one place.
Done. Hope it suites your expectations.
I currently try to solve the problem stated in #125 and I had the following problems while discovering the introspection API:
The accessor modes should be easily accessible, e.g., to get an accessor of a specific mode. Currently, the
PojoDescriptor#getAccessor
methods specify a parametermode
to be set of typePojoPropertyAccessorMode<ACCESSOR>
. Nevertheless, it is not possible to easily access valid instances for this parameter as the static accessible fields are classified in different subclasses likePojoPropertyAccessorNonArgMode
.Two valid solutions: