Class BaseNodeMetaModel

  • Direct Known Subclasses:
    NodeMetaModel

    public abstract class BaseNodeMetaModel
    extends java.lang.Object
    Meta-data about all classes in the AST. These are all Nodes, except NodeList.
    • 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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.