Class ClasspathModelKnowledge
java.lang.Object
org.gcube.informationsystem.discovery.knowledge.ClasspathModelKnowledge
Manages the discovered knowledge for a specific model, including type
hierarchies and usage information, sourced from classpath scanning.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the knowledge base has been created.protected Map<AccessType,Dag<Class<Element>>> A map of class hierarchy DAGs, keyed by access type.protected Map<AccessType,Discovery<Element>> A map of discovery instances, keyed by access type.The set of packages to be scanned. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newClasspathModelKnowledgeinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPackages(Collection<Package> packages) Adds a collection of packages to be scanned for model types.voidCreates the knowledge base by discovering types, building hierarchies, and gathering usage information.voidcreateKnowledge(boolean force) Creates the knowledge base, with an option to force recreation.voidcreateKnowledge(Collection<ClasspathModelKnowledge> modelKnowledges) Creates the knowledge base by merging the classes already discovered by other, previously createdClasspathModelKnowledgeinstances, avoiding a redundant rescan of their packages.getClassesDag(AccessType accessType) Returns the class hierarchy DAG for a specific access type.getDiscovery(AccessType accessType) Returns the discovery instance for a specific access type.
-
Field Details
-
created
protected boolean createdWhether the knowledge base has been created. -
dags
A map of class hierarchy DAGs, keyed by access type. -
discoveries
A map of discovery instances, keyed by access type. -
packages
The set of packages to be scanned.
-
-
Constructor Details
-
ClasspathModelKnowledge
public ClasspathModelKnowledge()Constructs a newClasspathModelKnowledgeinstance.
-
-
Method Details
-
createKnowledge
Creates the knowledge base, with an option to force recreation.- Parameters:
force-trueto force recreation of the knowledge base.- Throws:
Exception- if an error occurs during creation.
-
addPackages
Adds a collection of packages to be scanned for model types.- Parameters:
packages- The packages to add.
-
createKnowledge
Creates the knowledge base by discovering types, building hierarchies, and gathering usage information.- Throws:
Exception- if an error occurs during creation.
-
createKnowledge
Creates the knowledge base by merging the classes already discovered by other, previously createdClasspathModelKnowledgeinstances, 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
Returns the class hierarchy DAG for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Dagof classes.
-
getDiscovery
Returns the discovery instance for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Discoveryinstance.
-