Class PropertyMetaModel

java.lang.Object
com.github.javaparser.metamodel.PropertyMetaModel

public class PropertyMetaModel extends Object
Meta-data about a property of a node in the AST.
  • Constructor Details

  • Method Details

    • is

      public boolean is(Class<? extends Node> c, String fieldName)
      Returns:
      is this the field fieldName on class c?
    • is

      public boolean is(String fieldName)
      Returns:
      is this fields called fieldName?
    • getSetterMethodName

      public String getSetterMethodName()
      Returns:
      the name used in the AST for the setter
    • getGetterMethodName

      public String getGetterMethodName()
      Returns:
      the name used in the AST for the getter
    • getContainingNodeMetaModel

      public BaseNodeMetaModel getContainingNodeMetaModel()
      Returns:
      the NodeMetaModel that "has" this property.
    • getName

      public String getName()
      Returns:
      the name of the property. This is equal to the name of the field in the AST.
    • isNonEmpty

      public boolean isNonEmpty()
      Returns:
      if this property is a String or a NodeList: whether it may be empty.
    • getType

      public Class<?> getType()
      Returns:
      the class of the field.
    • getNodeReference

      public Optional<BaseNodeMetaModel> getNodeReference()
      Returns:
      if this property is a Node, this will get the node meta model.
    • isOptional

      public boolean isOptional()
      Returns:
      whether this property is optional.
    • isRequired

      public boolean isRequired()
      Returns:
      whether this property is not optional.
    • isNodeList

      public boolean isNodeList()
      Returns:
      whether this property is contained in a NodeList.
    • hasWildcard

      public boolean hasWildcard()
      Returns:
      whether this property has a wildcard following it, like BodyDeclaration<?>.
    • isSingular

      public boolean isSingular()
      Returns:
      whether this property is not a list or set.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getTypeNameGenerified

      public String getTypeNameGenerified()
      Returns:
      the type of a single element of this property, so no Optional or NodeList.
    • getTypeName

      public String getTypeName()
      Returns:
      the raw type of a single element of this property, so nothing but the name.
    • getTypeNameForGetter

      public String getTypeNameForGetter()
      Returns:
      the type that is returned from getters in the AST.
    • getTypeNameForSetter

      public String getTypeNameForSetter()
      Returns:
      the type that is passed to setters in the AST.
    • isNode

      public boolean isNode()
      Returns:
      is this property an AST Node?
    • getMetaModelFieldName

      public String getMetaModelFieldName()
      The name of the field in the containing BaseNodeMetaModel for this property meta model.
    • isAttribute

      public boolean isAttribute()
      Returns:
      is this property an attribute, meaning: not a node?
    • getValue

      public Object getValue(Node node)
      Introspects the node to get the value from this field. Note that an optional empty field will return null here.