Description
omar alles opened DATAMONGO-1291 and commented
BasicMongoPersistentEntity captures Mongo metadata of domain objects to be persisted to mongodb (such as collection name) needing for that purpose the Document annotation for that type.
Currently, the annotation is obtained through T.class.getAnnotation() method meaning that a reference is obtained if the annotation is present, else returning null.
Using AnnotationUtils.findAnnotation() instead, could easily extend this behavior resulting in more use cases to annotate domain objects.
As findAnnotation() javadoc states, " it finds a single annotation [...]
The algorithm operates as follows:
-
Search for the annotation on the given class and return it if found.
-
Recursively search through all annotations that the given class declares.
-
Recursively search through all interfaces that the given class declares.
-
Recursively search through the superclass hierarchy of the given class.
"
Being 1 the current behavior. -
states findAnnotation() metaannotation support, meaning that i could create my custom annotation annotated with Document. And this is an interesting feature. Even more thinking in Spring 4.2 AliasFor annotation.
Referenced from: pull request #326, and commits 9defa68, ddc3925, 477984b