Package com.github.javaparser.metamodel
Class BaseNodeMetaModel
- java.lang.Object
-
- com.github.javaparser.metamodel.BaseNodeMetaModel
-
- Direct Known Subclasses:
NodeMetaModel
public abstract class BaseNodeMetaModel extends java.lang.ObjectMeta-data about all classes in the AST. These are all Nodes, except NodeList.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PropertyMetaModel>constructorParametersprivate java.util.List<PropertyMetaModel>declaredPropertyMetaModelsprivate java.util.List<PropertyMetaModel>derivedPropertyMetaModelsprivate booleanhasWildcardprivate booleanisAbstractprivate java.lang.Stringnameprivate java.lang.StringpackageNameprivate java.util.Optional<BaseNodeMetaModel>superNodeMetaModelprivate java.lang.Class<? extends Node>type
-
Constructor Summary
Constructors Constructor Description BaseNodeMetaModel(java.util.Optional<BaseNodeMetaModel> superNodeMetaModel, java.lang.Class<? extends Node> type, java.lang.String name, java.lang.String packageName, boolean isAbstract, boolean hasWildcard)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Nodeconstruct(java.util.Map<java.lang.String,java.lang.Object> parameters)Creates a new node of this type.booleanequals(java.lang.Object o)java.util.List<PropertyMetaModel>getAllPropertyMetaModels()java.util.List<PropertyMetaModel>getConstructorParameters()java.util.List<PropertyMetaModel>getDeclaredPropertyMetaModels()java.util.List<PropertyMetaModel>getDerivedPropertyMetaModels()java.lang.StringgetMetaModelFieldName()The name of the field in JavaParserMetaModel for this node meta model.java.lang.StringgetPackageName()java.lang.StringgetQualifiedClassName()java.util.Optional<BaseNodeMetaModel>getSuperNodeMetaModel()java.lang.Class<? extends Node>getType()java.lang.StringgetTypeName()java.lang.StringgetTypeNameGenerified()inthashCode()booleanhasWildcard()booleanis(java.lang.Class<? extends Node> c)booleanisAbstract()booleanisInstanceOfMetaModel(BaseNodeMetaModel baseMetaModel)booleanisRootNode()java.lang.StringtoString()
-
-
-
Field Detail
-
superNodeMetaModel
private final java.util.Optional<BaseNodeMetaModel> superNodeMetaModel
-
declaredPropertyMetaModels
private final java.util.List<PropertyMetaModel> declaredPropertyMetaModels
-
derivedPropertyMetaModels
private final java.util.List<PropertyMetaModel> derivedPropertyMetaModels
-
constructorParameters
private final java.util.List<PropertyMetaModel> constructorParameters
-
type
private final java.lang.Class<? extends Node> type
-
name
private final java.lang.String name
-
packageName
private final java.lang.String packageName
-
isAbstract
private final boolean isAbstract
-
hasWildcard
private final boolean hasWildcard
-
-
Constructor Detail
-
BaseNodeMetaModel
public BaseNodeMetaModel(java.util.Optional<BaseNodeMetaModel> superNodeMetaModel, java.lang.Class<? extends Node> type, java.lang.String name, java.lang.String packageName, boolean isAbstract, boolean hasWildcard)
-
-
Method Detail
-
is
public boolean is(java.lang.Class<? extends Node> c)
- Returns:
- is this the meta model for this node class?
-
getQualifiedClassName
public java.lang.String getQualifiedClassName()
- Returns:
- package name + class name
-
getSuperNodeMetaModel
public java.util.Optional<BaseNodeMetaModel> getSuperNodeMetaModel()
- Returns:
- the meta model for the node that this node extends. Note that this is to be used to find properties defined in superclasses of a Node.
-
getDeclaredPropertyMetaModels
public java.util.List<PropertyMetaModel> getDeclaredPropertyMetaModels()
- Returns:
- a list of all properties declared directly in this node (not its parent nodes.) These are also available as fields.
-
getDerivedPropertyMetaModels
public java.util.List<PropertyMetaModel> getDerivedPropertyMetaModels()
-
getConstructorParameters
public java.util.List<PropertyMetaModel> getConstructorParameters()
- Returns:
- a list of all properties that describe the parameters to the all-fields (but not "range" and "comment") constructor, in the order of appearance in the constructor parameter list.
-
getAllPropertyMetaModels
public java.util.List<PropertyMetaModel> getAllPropertyMetaModels()
- Returns:
- a list of all properties in this node and its parents. Note that a new list is created every time this method is called.
-
isInstanceOfMetaModel
public boolean isInstanceOfMetaModel(BaseNodeMetaModel baseMetaModel)
-
getType
public java.lang.Class<? extends Node> getType()
- Returns:
- the class for this AST node type.
-
getPackageName
public java.lang.String getPackageName()
- Returns:
- the package containing this AST node class.
-
isAbstract
public boolean isAbstract()
- Returns:
- whether this AST node is abstract.
-
hasWildcard
public boolean hasWildcard()
- Returns:
- whether this AST node has a <?> at the end of its type.
-
isRootNode
public boolean isRootNode()
- Returns:
- whether this AST node is the root node, meaning that it is the meta model for "Node": "NodeMetaModel".
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getTypeNameGenerified
public java.lang.String getTypeNameGenerified()
- Returns:
- the type name, with generics.
-
getTypeName
public java.lang.String getTypeName()
- Returns:
- the raw type name, so nothing but the name.
-
getMetaModelFieldName
public java.lang.String getMetaModelFieldName()
The name of the field in JavaParserMetaModel for this node meta model.
-
construct
public Node construct(java.util.Map<java.lang.String,java.lang.Object> parameters)
Creates a new node of this type.- Parameters:
parameters- a map of propertyName -> value. This should at least contain a pair for every required property for this node.
-
-