Package spoon.metamodel
Class Metamodel
java.lang.Object
spoon.metamodel.Metamodel
Represents the Spoon metamodel (incl. at runtime)
-
Field Summary
FieldsModifier and TypeFieldDescriptionqualified names of packages which contain classes (implementations) of spoon modelqualified names of packages which contain interfaces of spoon model -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all interfaces of the Spoon metamodel.getConcept(Class<? extends CtElement> clazz)static StringgetConceptName(Class<? extends CtElement> conceptClass)static StringgetConceptName(CtType<?> type)static @Nullable CtClass<?>getImplementationOfInterface(CtInterface<?> iface)static Metamodelstatic @Nullable CtInterface<?>getInterfaceOfImplementation(CtClass<?> impl)static CtRolegetRoleOfMethod(CtMethod<?> method)
-
Field Details
-
MODEL_IFACE_PACKAGES
qualified names of packages which contain interfaces of spoon model -
MODEL_CLASS_PACKAGES
qualified names of packages which contain classes (implementations) of spoon model
-
-
Constructor Details
-
Metamodel
Not in the public API. Parses spoon sources and creates factory with spoon model.- Parameters:
spoonJavaSourcesDirectory- the root directory of java sources of spoon model. The directory must contain "spoon" directory.
-
Metamodel
- Parameters:
factory- already loaded factory with all Spoon model types
-
-
Method Details
-
getAllMetamodelInterfaces
Returns all interfaces of the Spoon metamodel. This method is stateless for sake of maintenance. If you need to call it several times, you should store the result. -
getInstance
- Returns:
- Spoon
Metamodel, which is built once and then returns cached version
-
getConcept
- Parameters:
clazz- aClassof Spoon model- Returns:
MetamodelConceptwhich describes the `clazz`
-
getConcepts
- Returns:
- all
MetamodelConcepts of spoon meta model
-
getAllInstantiableMetamodelInterfaces
- Returns:
- List of Spoon model interfaces, which represents instantiable leafs of Spoon metamodel
-
getConceptName
- Parameters:
type- a spoon model class or interface, whose concept name has to be returned- Returns:
- name of
MetamodelConcept, which represents Spoon modelCtType
-
getConceptName
-
getImplementationOfInterface
- Parameters:
iface- the interface of spoon model element- Returns:
CtClassof Spoon model which implements the spoon model interface. null if there is no implementation.
-
getInterfaceOfImplementation
- Parameters:
impl- the implementation class of a Spoon element- Returns:
CtInterfaceof Spoon model which represents API of the spoon model class. null if there is no implementation.
-
getRoleOfMethod
- Parameters:
method- to be checked method- Returns:
CtRoleof spoon model method. Looking into all super class/interface implementations of this method
-