Class MetamodelProperty

  • public class MetamodelProperty
    extends java.lang.Object
    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 Detail

      • getName

        public java.lang.String getName()
      • getRole

        public CtRole getRole()
      • getOwner

        public MetamodelConcept getOwner()
        returns the concept that holds this property
      • getContainerKind

        public ContainerKind getContainerKind()
        returns the kind of property (list, value, etc)
      • getTypeOfField

        public CtTypeReference<?> getTypeOfField()
        Return the type of the field for List<String> field the ValueType is List for String field the ValueType is String
      • getMethodBySignature

        public MMMethod getMethodBySignature​(java.lang.String signature)
        MMMethod accessing this property, which has signature `signature`
      • getMethods

        public java.util.Set<MMMethod> getMethods()
        all methods which are accessing this property
      • isUnsettable

        public boolean isUnsettable()
        true if this MetamodelProperty is unsettable in owner concept ie. if the property has the annotation @UnsettableProperty
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • getSuperProperty

        public MetamodelProperty getSuperProperty()
        the super MetamodelProperty which has same valueType and which is upper in the metamodel hierarchy For example: The super property of CtField#NAME is CtNamedElement#NAME This method can be used to optimize generated code.
      • getRoleHandler

        public RoleHandler getRoleHandler()
        RoleHandler which can access runtime data of this Property
      • getValue

        public <T,​U> U getValue​(T element)
        element - an instance whose attribute value is read
        a value of attribute defined by this MetamodelProperty from the provided `element`
      • setValue

        public <T,​U> void setValue​(T element,
                                         U value)
        element - an instance whose attribute value is set
        value - to be set value of attribute defined by this MetamodelProperty on the provided `element`