Class ClasspathModelKnowledge


  • public class ClasspathModelKnowledge
    extends Object
    Manages the discovered knowledge for a specific model, including type hierarchies and usage information, sourced from classpath scanning.
    Author:
    Luca Frosini (ISTI - CNR)
    • Field Detail

      • created

        protected boolean created
        Whether the knowledge base has been created.
      • packages

        protected Set<Package> packages
        The set of packages to be scanned.
    • Constructor Detail

      • ClasspathModelKnowledge

        public ClasspathModelKnowledge()
        Constructs a new ClasspathModelKnowledge instance.
    • Method Detail

      • createKnowledge

        public void createKnowledge​(boolean force)
                             throws Exception
        Creates the knowledge base, with an option to force recreation.
        Parameters:
        force - true to force recreation of the knowledge base.
        Throws:
        Exception - if an error occurs during creation.
      • addPackages

        public void addPackages​(Collection<Package> packages)
        Adds a collection of packages to be scanned for model types.
        Parameters:
        packages - The packages to add.
      • createKnowledge

        public void createKnowledge()
                             throws Exception
        Creates the knowledge base by discovering types, building hierarchies, and gathering usage information.
        Throws:
        Exception - if an error occurs during creation.
      • createKnowledge

        public void createKnowledge​(Collection<ClasspathModelKnowledge> modelKnowledges)
                             throws Exception
        Creates the knowledge base by merging the classes already discovered by other, previously created ClasspathModelKnowledge instances, avoiding a redundant rescan of their packages.
        Parameters:
        modelKnowledges - The already-created model knowledges to merge.
        Throws:
        Exception - if an error occurs during creation.
      • getClassesDag

        public Dag<Class<Element>> getClassesDag​(AccessType accessType)
        Returns the class hierarchy DAG for a specific access type.
        Parameters:
        accessType - The access type.
        Returns:
        The Dag of classes.
      • getDiscovery

        public Discovery<Element> getDiscovery​(AccessType accessType)
        Returns the discovery instance for a specific access type.
        Parameters:
        accessType - The access type.
        Returns:
        The Discovery instance.