Class MetaStore

java.lang.Object
dxt.scanpath.v2.mstore.MetaStore

public class MetaStore extends Object
Stores relationships discovered while scanning class metadata.

The store tracks inheritance, class annotations, field annotations, and method annotations, and can resolve the recorded class names through its configured class loader.

Author:
indroneel
  • Constructor Details

    • MetaStore

      public MetaStore()
      Creates an empty metadata store using the current thread's context class loader when available.
  • Method Details

    • setClassLoader

      public void setClassLoader(ClassLoader cl)
      Sets the class loader used when resolving recorded class names.

      If cl is null, the thread context loader and then this class's loader are used as fallbacks.

      Parameters:
      cl - the class loader to use, or null to select a fallback loader
    • addInheritance

      public void addInheritance(String baseName, String clsName)
      Records that a class inherits from a base class or interface.
      Parameters:
      baseName - the fully qualified base type name
      clsName - the fully qualified inheriting class name
    • addClassWithAnnotation

      public void addClassWithAnnotation(String ann, String clsName)
      Records a class that has the specified class-level annotation.
      Parameters:
      ann - the fully qualified annotation type name
      clsName - the fully qualified annotated class name
    • addClassWithFieldAnnotation

      public void addClassWithFieldAnnotation(String ann, String clsName)
      Records a class that has a field with the specified annotation.
      Parameters:
      ann - the fully qualified annotation type name
      clsName - the fully qualified class name
    • addClassWithMethodAnnotation

      public void addClassWithMethodAnnotation(String ann, String clsName)
      Records a class that has a method with the specified annotation.
      Parameters:
      ann - the fully qualified annotation type name
      clsName - the fully qualified class name
    • listInheritingClasses

      public List<Class<?>> listInheritingClasses(String baseName)
      Resolves and returns classes recorded as inheriting from the supplied base type.
      Parameters:
      baseName - the fully qualified base type name
      Returns:
      the resolved inheriting classes
    • listAnnotatedClasses

      public List<Class<?>> listAnnotatedClasses(String ann)
      Resolves and returns classes recorded with the supplied class-level annotation.
      Parameters:
      ann - the fully qualified annotation type name
      Returns:
      the resolved annotated classes
    • listClassesWithAnnotatedFields

      public List<Class<?>> listClassesWithAnnotatedFields(String ann)
      Resolves and returns classes recorded with fields carrying the supplied annotation.
      Parameters:
      ann - the fully qualified annotation type name
      Returns:
      the resolved classes
    • listClassesWithAnnotatedMethods

      public List<Class<?>> listClassesWithAnnotatedMethods(String ann)
      Resolves and returns classes recorded with methods carrying the supplied annotation.
      Parameters:
      ann - the fully qualified annotation type name
      Returns:
      the resolved classes
    • dumpState

      public List<String> dumpState(String identStr)
      Produces a human-readable representation of all recorded relationships.
      Parameters:
      identStr - an identifier included in the dump header and footer
      Returns:
      the dump split into individual lines