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 booleanequals(Object o)BaseNodeMetaModelgetContainingNodeMetaModel()StringgetGetterMethodName()StringgetMetaModelFieldName()The name of the field in the containing BaseNodeMetaModel for this property meta model.StringgetName()Optional<BaseNodeMetaModel>getNodeReference()StringgetSetterMethodName()Class<?>getType()StringgetTypeName()StringgetTypeNameForGetter()StringgetTypeNameForSetter()StringgetTypeNameGenerified()ObjectgetValue(Node node)Introspects the node to get the value from this field.inthashCode()booleanhasWildcard()booleanis(Class<? extends Node> c, String fieldName)booleanis(String fieldName)booleanisAttribute()booleanisNode()booleanisNodeList()booleanisNonEmpty()booleanisOptional()booleanisRequired()booleanisSingular()StringtoString()
-
-
-
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?
-
-