Package com.github.javaparser.metamodel
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 Summary
Constructors Constructor Description PropertyMetaModel(BaseNodeMetaModel containingNodeMetaModel, String name, Class<?> type, Optional<BaseNodeMetaModel> nodeReference, boolean isOptional, boolean isNonEmpty, boolean isNodeList, boolean hasWildcard)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
BaseNodeMetaModel
getContainingNodeMetaModel()
String
getGetterMethodName()
String
getMetaModelFieldName()
The name of the field in the containing BaseNodeMetaModel for this property meta model.String
getName()
Optional<BaseNodeMetaModel>
getNodeReference()
String
getSetterMethodName()
Class<?>
getType()
String
getTypeName()
String
getTypeNameForGetter()
String
getTypeNameForSetter()
String
getTypeNameGenerified()
Object
getValue(Node node)
Introspects the node to get the value from this field.int
hashCode()
boolean
hasWildcard()
boolean
is(Class<? extends Node> c, String fieldName)
boolean
is(String fieldName)
boolean
isAttribute()
boolean
isNode()
boolean
isNodeList()
boolean
isNonEmpty()
boolean
isOptional()
boolean
isRequired()
boolean
isSingular()
String
toString()
-
-
-
Constructor Detail
-
PropertyMetaModel
public PropertyMetaModel(BaseNodeMetaModel containingNodeMetaModel, String name, Class<?> type, Optional<BaseNodeMetaModel> nodeReference, boolean isOptional, boolean isNonEmpty, boolean isNodeList, boolean hasWildcard)
-
-
Method Detail
-
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.
-
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?
-
-