Class MetaStore

java.lang.Object
dxt.scanpath.v1.support.MetaStore

public class MetaStore extends Object
Stores metadata about classes discovered on the classpath, including inheritance relationships and annotations on classes, fields, and methods.
Author:
indroneel
  • 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

      public void setClassLoader(ClassLoader cl)
      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

      public void addInheritance(String baseName, String clsName)
      Adds an inheritance relationship between a base class and a derived class to the metadata store.
      Parameters:
      baseName - the fully qualified name of the base class
      clsName - the fully qualified name of the derived class
    • addClassWithAnnotation

      public void addClassWithAnnotation(String ann, String clsName)
      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 annotation
      clsName - the fully qualified name of the class that has the annotation
    • addClassWithFieldAnnotation

      public void addClassWithFieldAnnotation(String ann, String clsName)
      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 annotation
      clsName - the fully qualified name of the class that has the field annotation
    • addClassWithMethodAnnotation

      public void addClassWithMethodAnnotation(String ann, String clsName)
      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 annotation
      clsName - the fully qualified name of the class that has the method annotation
    • listInheritingClasses

      public List<Class<?>> listInheritingClasses(String baseName)
      Retrieves a list of Java types that inherit from or implement the specified base type.
      Parameters:
      baseName - the fully qualified name of the base type
      Returns:
      a list of Java types that inherit from or implement the specified base type
    • listAnnotatedClasses

      public List<Class<?>> listAnnotatedClasses(String ann)
      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

      public List<Class<?>> listClassesWithAnnotatedFields(String ann)
      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

      public List<Class<?>> listClassesWithAnnotatedMethods(String ann)
      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