Class MethodGenerator
- java.lang.Object
-
- org.glassfish.pfl.dynamic.codegen.impl.MemberInfoBase
-
- org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase
-
- org.glassfish.pfl.dynamic.codegen.impl.MethodGenerator
-
- All Implemented Interfaces:
AttributedObject
,Node
,MemberInfo
,MethodInfo
public final class MethodGenerator extends MethodInfoBase implements Node
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
argsComplete
private BlockStatement
body
private boolean
isConstructor
private Node
nodeImpl
-
Fields inherited from class org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase
arguments, exceptions, rtype
-
-
Constructor Summary
Constructors Constructor Description MethodGenerator(ClassGeneratorImpl parent, int modifiers, java.util.List<Type> exceptions)
Construct a MethodGenerator that represents a constructor.MethodGenerator(ClassGeneratorImpl parent, int modifiers, Type rtype, java.lang.String name, java.util.List<Type> exceptions)
Construct a MethodGenerator that represents a method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Visitor visitor)
Accept the visitor and allow it to perform actions on this Node.Variable
addArgument(Type type, java.lang.String ident)
void
argsComplete()
java.util.List<java.lang.Object>
attributes()
Internal method for dynamic attribute support.BlockStatement
body()
<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.java.lang.Object
get(int index)
Internal method for dynamic attribute support.<T extends Node>
TgetAncestor(java.lang.Class<T> type)
Return the first ancestor of this node of the given type, if any.int
hashCode()
int
id()
Return the unique ID of this node.boolean
isConstructor()
Returns true if this is a constructor, false if method.Node
parent()
Return the Node that contains (and created) this Node.void
parent(Node node)
Set the parent to a new value.void
set(int index, java.lang.Object obj)
Internal method for dynamic attribute support.-
Methods inherited from class org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase
arguments, clearHashCode, equals, exceptions, getConstructor, getMethod, returnType, signature
-
Methods inherited from class org.glassfish.pfl.dynamic.codegen.impl.MemberInfoBase
isAccessibleInContext, modifiers, myClassInfo, name, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.glassfish.pfl.dynamic.codegen.spi.MemberInfo
isAccessibleInContext, modifiers, myClassInfo, name
-
-
-
-
Field Detail
-
nodeImpl
private Node nodeImpl
-
isConstructor
private boolean isConstructor
-
argsComplete
private boolean argsComplete
-
body
private BlockStatement body
-
-
Constructor Detail
-
MethodGenerator
MethodGenerator(ClassGeneratorImpl parent, int modifiers, java.util.List<Type> exceptions)
Construct a MethodGenerator that represents a constructor.
-
MethodGenerator
MethodGenerator(ClassGeneratorImpl parent, int modifiers, Type rtype, java.lang.String name, java.util.List<Type> exceptions)
Construct a MethodGenerator that represents a method.
-
-
Method Detail
-
body
public BlockStatement body()
-
parent
public Node parent()
Description copied from interface:Node
Return the Node that contains (and created) this Node.
-
id
public int id()
Description copied from interface:Node
Return the unique ID of this node. This starts at 1 and is incremented for each new Node that is created.
-
parent
public void parent(Node node)
Description copied from interface:Node
Set the parent to a new value. Should only be called inside NodeBase.
-
getAncestor
public <T extends Node> T getAncestor(java.lang.Class<T> type)
Description copied from interface:Node
Return the first ancestor of this node of the given type, if any. Throws IllegalArgumentException if not found.- Specified by:
getAncestor
in interfaceNode
-
copy
public <T extends Node> T copy(java.lang.Class<T> cls)
Description copied from interface:Node
Make 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:Node
Copy setting a new parent in the result.
-
get
public java.lang.Object get(int index)
Description copied from interface:AttributedObject
Internal method for dynamic attribute support. Return the value of the attribute at index. If the attribute at index is not set, set it to the default value and return the default.- Specified by:
get
in interfaceAttributedObject
-
set
public void set(int index, java.lang.Object obj)
Description copied from interface:AttributedObject
Internal method for dynamic attribute support. Set the attribute at index to obj.- Specified by:
set
in interfaceAttributedObject
-
attributes
public java.util.List<java.lang.Object> attributes()
Description copied from interface:AttributedObject
Internal method for dynamic attribute support. Return all attributes for this node (may be null).- Specified by:
attributes
in interfaceAttributedObject
-
isConstructor
public boolean isConstructor()
Description copied from interface:MethodInfo
Returns true if this is a constructor, false if method.- Specified by:
isConstructor
in interfaceMethodInfo
- Overrides:
isConstructor
in classMethodInfoBase
-
argsComplete
public void argsComplete()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classMethodInfoBase
-
-