Class NodeBase
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.AttributedObjectBase
-
- org.glassfish.pfl.dynamic.codegen.impl.NodeBase
-
- All Implemented Interfaces:
AttributedObject,Node,CopyInterceptor
- Direct Known Subclasses:
ExpressionFactory.ExpressionBase,StatementBase
public class NodeBase extends AttributedObjectBase implements Node, CopyInterceptor
Base class for implementing various kinds of Nodes in the AST. This mainly supports dynamic attributes. It also supports dynamic delegation to another node. Dynamic attributes not found in the current node will automatically be searched for in the delegate.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Accept the visitor and allow it to perform actions on this Node.<T extends Node>
Tcopy(java.lang.Class<T> cls)Make a deep copy of this node.<T extends Node>
Tcopy(Node newParent, java.lang.Class<T> cls)Copy setting a new parent in the result.<T extends Node>
TgetAncestor(java.lang.Class<T> type)Return the first ancestor of this node of the given type, if any.private static intgetNewId()intid()Return the unique ID of this node.Nodeparent()Return the Node that contains (and created) this Node.voidparent(Node node)Set the parent to a new value.voidpostCopy()voidpreCopy()java.lang.StringtoString()-
Methods inherited from class org.glassfish.pfl.dynamic.codegen.impl.AttributedObjectBase
attributes, get, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.glassfish.pfl.dynamic.codegen.impl.AttributedObject
attributes, get, set
-
-
-
-
Constructor Detail
-
NodeBase
public NodeBase(Node parent)
-
-
Method Detail
-
preCopy
public void preCopy()
- Specified by:
preCopyin interfaceCopyInterceptor- Overrides:
preCopyin classAttributedObjectBase
-
postCopy
public void postCopy()
- Specified by:
postCopyin interfaceCopyInterceptor- Overrides:
postCopyin classAttributedObjectBase
-
getNewId
private static int getNewId()
-
getAncestor
public final <T extends Node> T getAncestor(java.lang.Class<T> type)
Description copied from interface:NodeReturn the first ancestor of this node of the given type, if any. Throws IllegalArgumentException if not found.- Specified by:
getAncestorin interfaceNode
-
id
public int id()
Description copied from interface:NodeReturn the unique ID of this node. This starts at 1 and is incremented for each new Node that is created.
-
parent
public final Node parent()
Description copied from interface:NodeReturn the Node that contains (and created) this Node.
-
parent
public final void parent(Node node)
Description copied from interface:NodeSet the parent to a new value. Should only be called inside NodeBase.
-
copy
public <T extends Node> T copy(java.lang.Class<T> cls)
Description copied from interface:NodeMake a deep copy of this node. If nn = n.copy(), then n.parent() == nn.parent(), which also means that the parent is NOT copied.
-
copy
public <T extends Node> T copy(Node newParent, java.lang.Class<T> cls)
Description copied from interface:NodeCopy setting a new parent in the result.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-