Class MetaStore
java.lang.Object
dxt.scanpath.v1.support.MetaStore
Stores metadata about classes discovered on the classpath, including inheritance relationships
and annotations on classes, fields, and methods.
- Author:
- indroneel
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new MetaStore instance that will use the current thread's context class loader to load classes. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassWithAnnotation(String ann, String clsName) Adds a class with a specific annotation to the metadata store.voidaddClassWithFieldAnnotation(String ann, String clsName) Adds a class with a specific field annotation to the metadata store.voidaddClassWithMethodAnnotation(String ann, String clsName) Adds a class with a specific method annotation to the metadata store.voidaddInheritance(String baseName, String clsName) Adds an inheritance relationship between a base class and a derived class to the metadata store.Retrieves a list of Java types that are annotated with the specified annotation.Retrieves a list of Java types that have at least one field annotated with the specified annotation.Retrieves a list of Java types that have at least one method annotated with the specified annotation.listInheritingClasses(String baseName) Retrieves a list of Java types that inherit from or implement the specified base type.voidSets the class loader to use when loading classes from the metadata store.
-
Constructor Details
-
MetaStore
public MetaStore()Creates a new MetaStore instance that will use the current thread's context class loader to load classes.
-
-
Method Details
-
setClassLoader
Sets the class loader to use when loading classes from the metadata store. If the provided class loader is null, the current thread's context class loader will be used instead.- Parameters:
cl- the class loader to use for loading classes, or null to use the current thread's context class loader
-
addInheritance
-
addClassWithAnnotation
Adds a class with a specific annotation to the metadata store. The annotation is applied on the class itself, or any of its parent class/interface.- Parameters:
ann- the fully qualified name of the annotationclsName- the fully qualified name of the class that has the annotation
-
addClassWithFieldAnnotation
Adds a class with a specific field annotation to the metadata store. The annotation is applied on a field of the class.- Parameters:
ann- the fully qualified name of the field annotationclsName- the fully qualified name of the class that has the field annotation
-
addClassWithMethodAnnotation
Adds a class with a specific method annotation to the metadata store. The annotation is applied on a method of the class.- Parameters:
ann- the fully qualified name of the method annotationclsName- the fully qualified name of the class that has the method annotation
-
listInheritingClasses
-
listAnnotatedClasses
Retrieves a list of Java types that are annotated with the specified annotation. Alternatively, the list may also include types that inherit from or implement at least one Java type that is annotated with the specified annotation.- Parameters:
ann- the fully qualified name of the annotation- Returns:
- a list of annotated Java types
-
listClassesWithAnnotatedFields
Retrieves a list of Java types that have at least one field annotated with the specified annotation. Alternatively, the list may also include types that inherit from or implement at least one Java type that has at least one field annotated with the specified annotation.- Parameters:
ann- the fully qualified name of the field annotation- Returns:
- a list of Java types with annotated fields
-
listClassesWithAnnotatedMethods
Retrieves a list of Java types that have at least one method annotated with the specified annotation. Alternatively, the list may also include types that inherit from or implement at least one Java type that has at least one method annotated with the specified annotation.- Parameters:
ann- the fully qualified name of the method annotation- Returns:
- a list of Java types with annotated methods
-