Package spoon.metamodel
Class MetamodelProperty
java.lang.Object
spoon.metamodel.MetamodelProperty
Represents a property of the Spoon metamodel.
A property:
- is an abstraction of a concrete field in an implementation class
- the
MetamodelConcept is the owner of this role, it models the implementation class that contains the field.
- encapsulates a pair (CtRole, MetamodelConcept).
- captures both the type of the field (eg list) and the type of items (eg String).-
Method Summary
Modifier and TypeMethodDescriptionreturns the kind of property (list, value, etc)getMethod(MMMethodKind kind) getMethodBySignature(String signature) getMethods(MMMethodKind kind) getName()getOwner()returns the concept that holds this propertygetRole()Return the type of the field for List<String> field the ValueType is List for String field the ValueType is StringReturns the type of the property for List<String> field the ValueType is String for String field the ValueType is String (when getContainerKind ==ContainerKind.SINGLE,getTypeofItems()==getTypeOfField().<T,U> U getValue(T element) booleanboolean<T,U> void setValue(T element, U value) toString()
-
Method Details
-
getName
-
getRole
-
getOwner
returns the concept that holds this property -
getContainerKind
returns the kind of property (list, value, etc) -
getTypeOfField
Return the type of the field for List<String> field the ValueType is List for String field the ValueType is String -
getTypeofItems
Returns the type of the property for List<String> field the ValueType is String for String field the ValueType is String (when getContainerKind ==ContainerKind.SINGLE,getTypeofItems()==getTypeOfField(). -
getMethod
-
getMethodBySignature
- Returns:
MMMethodaccessing this property, which has signature `signature`
-
getMethods
- Parameters:
kind-MMMethodKind- Returns:
- methods of required `kind`
-
getMethods
- Returns:
- all methods which are accessing this property
-
isDerived
public boolean isDerived()- Returns:
- true if this
MetamodelPropertyis derived in owner concept, ig has the annotation @DerivedProperty.
-
isUnsettable
public boolean isUnsettable()- Returns:
- true if this
MetamodelPropertyis unsettable in owner concept ie. if the property has the annotation @UnsettableProperty
-
toString
-
getSuperProperty
- Returns:
- the super
MetamodelPropertywhich has same valueType and which is upper in the metamodel hierarchy For example: The super property ofCtField#NAME isCtNamedElement#NAME This method can be used to optimize generated code.
-
getRoleHandler
- Returns:
RoleHandlerwhich can access runtime data of this Property
-
getValue
public <T,U> U getValue(T element) - Parameters:
element- an instance whose attribute value is read- Returns:
- a value of attribute defined by this
MetamodelPropertyfrom the provided `element`
-
setValue
public <T,U> void setValue(T element, U value) - Parameters:
element- an instance whose attribute value is setvalue- to be set value of attribute defined by thisMetamodelPropertyon the provided `element`
-