How do I get all the fields and properties of an object (not class) that are annotated with specific annotation without iterating through all its fields or property descriptors?
My objective is to avoid unnecessary iteration through each and every field or property that is obviously not even annotated such as getClass() or any field of the class that is not a field or member variable of an instance.
Or is iteration the only way to go? Is there no other better way of doing this?
You could use the reflections package that does all the work for you. The description of the project:
Example: