Package spoon.metamodel
Class Metamodel
- java.lang.Object
-
- spoon.metamodel.Metamodel
-
public class Metamodel extends Object
Represents the Spoon metamodel (incl. at runtime)
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
MODEL_CLASS_PACKAGES
qualified names of packages which contain classes (implementations) of spoon modelstatic Set<String>
MODEL_IFACE_PACKAGES
qualified names of packages which contain interfaces of spoon model
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<CtType<? extends CtElement>>
getAllInstantiableMetamodelInterfaces()
static Set<CtType<?>>
getAllMetamodelInterfaces()
Returns all interfaces of the Spoon metamodel.MetamodelConcept
getConcept(Class<? extends CtElement> clazz)
static String
getConceptName(Class<? extends CtElement> conceptClass)
static String
getConceptName(CtType<?> type)
Collection<MetamodelConcept>
getConcepts()
static CtClass<?>
getImplementationOfInterface(CtInterface<?> iface)
static Metamodel
getInstance()
static CtInterface<?>
getInterfaceOfImplementation(CtClass<?> impl)
static CtRole
getRoleOfMethod(CtMethod<?> method)
-
-
-
Constructor Detail
-
Metamodel
public Metamodel(File spoonJavaSourcesDirectory)
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
protected Metamodel(Factory factory)
- Parameters:
factory
- already loaded factory with all Spoon model types
-
-
Method Detail
-
getAllMetamodelInterfaces
public static Set<CtType<?>> 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
public static Metamodel getInstance()
- Returns:
- Spoon
Metamodel
, which is built once and then returns cached version
-
getConcept
public MetamodelConcept getConcept(Class<? extends CtElement> clazz)
- Parameters:
clazz
- aClass
of Spoon model- Returns:
MetamodelConcept
which describes the `clazz`
-
getConcepts
public Collection<MetamodelConcept> getConcepts()
- Returns:
- all
MetamodelConcept
s of spoon meta model
-
getAllInstantiableMetamodelInterfaces
public List<CtType<? extends CtElement>> getAllInstantiableMetamodelInterfaces()
- Returns:
- List of Spoon model interfaces, which represents instantiable leafs of Spoon metamodel
-
getConceptName
public static String getConceptName(CtType<?> type)
- Parameters:
type
- a spoon model class or interface, whose concept name has to be returned- Returns:
- name of
MetamodelConcept
, which represents Spoon modelCtType
-
getImplementationOfInterface
public static CtClass<?> getImplementationOfInterface(CtInterface<?> iface)
- Parameters:
iface
- the interface of spoon model element- Returns:
CtClass
of Spoon model which implements the spoon model interface. null if there is no implementation.
-
getInterfaceOfImplementation
public static CtInterface<?> getInterfaceOfImplementation(CtClass<?> impl)
- Parameters:
impl
- the implementation class of a Spoon element- Returns:
CtInterface
of Spoon model which represents API of the spoon model class. null if there is no implementation.
-
-