Package com.github.javaparser.metamodel
Class PropertyMetaModel
java.lang.Object
com.github.javaparser.metamodel.PropertyMetaModel
Meta-data about a property of a node in the AST.
-
Constructor Summary
ConstructorDescriptionPropertyMetaModel(BaseNodeMetaModel containingNodeMetaModel, String name, Class<?> type, Optional<BaseNodeMetaModel> nodeReference, boolean isOptional, boolean isNonEmpty, boolean isNodeList, boolean hasWildcard)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
The name of the field in the containing BaseNodeMetaModel for this property meta model.getName()
Class<?>
getType()
Introspects the node to get the value from this field.int
hashCode()
boolean
boolean
boolean
boolean
boolean
isNode()
boolean
boolean
boolean
boolean
boolean
toString()
-
Constructor Details
-
PropertyMetaModel
public PropertyMetaModel(BaseNodeMetaModel containingNodeMetaModel, String name, Class<?> type, Optional<BaseNodeMetaModel> nodeReference, boolean isOptional, boolean isNonEmpty, boolean isNodeList, boolean hasWildcard)
-
-
Method Details
-
is
- Returns:
- is this the field fieldName on class c?
-
is
- Returns:
- is this fields called fieldName?
-
getSetterMethodName
- Returns:
- the name used in the AST for the setter
-
getGetterMethodName
- Returns:
- the name used in the AST for the getter
-
getContainingNodeMetaModel
- Returns:
- the NodeMetaModel that "has" this property.
-
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
- Returns:
- the class of the field.
-
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
-
equals
-
hashCode
public int hashCode() -
getTypeNameGenerified
- Returns:
- the type of a single element of this property, so no Optional or NodeList.
-
getTypeName
- Returns:
- the raw type of a single element of this property, so nothing but the name.
-
getTypeNameForGetter
- Returns:
- the type that is returned from getters in the AST.
-
getTypeNameForSetter
- Returns:
- the type that is passed to setters in the AST.
-
isNode
public boolean isNode()- Returns:
- is this property an AST Node?
-
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
Introspects the node to get the value from this field. Note that an optional empty field will return null here.
-