Top Fields Constructors Methods
org.glassfish.pfl.dynamic.codegen.impl

public final Class MethodGenerator

extends MethodInfoBase
implements Node
Class Inheritance
All Implemented Interfaces
org.glassfish.pfl.dynamic.codegen.impl.Node, org.glassfish.pfl.dynamic.codegen.impl.AttributedObject
Imports
java.util.List, org.glassfish.pfl.dynamic.codegen.spi.Type, .Variable

Field Summary

Modifier and TypeField and Description
private boolean
private BlockStatement
private boolean
private Node
Inherited from org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase:
argumentsexceptionsrtype

Constructor Summary

AccessConstructor and Description
pack-priv
MethodGenerator(ClassGeneratorImpl parent, int modifiers, List<Type> exceptions)

Construct a MethodGenerator that represents a constructor.

pack-priv
MethodGenerator(ClassGeneratorImpl parent, int modifiers, Type rtype, String name, List<Type> exceptions)

Construct a MethodGenerator that represents a method.

Method Summary

Modifier and TypeMethod and Description
public void
accept(Visitor visitor)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Accept the visitor and allow it to perform actions on this Node.

public Variable
addArgument(Type type, String ident)

public void
public List<Object>
attributes()

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.attributes.

Internal method for dynamic attribute support.

public BlockStatement
body()

public <T extends Node> T
copy(Class<T> cls)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

Make a deep copy of this node.

public <T extends Node> T
copy(Node newParent, Class<T> cls)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

Copy setting a new parent in the result.

public Object
get(int index)

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.get.

Internal method for dynamic attribute support.

public <T extends Node> T
getAncestor(Class<T> type)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.getAncestor.

Return the first ancestor of this node of the given type, if any.

public int
hashCode()

Overrides org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase.hashCode.

Returns a hash code value for this object.

public int
id()

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.id.

Return the unique ID of this node.

public boolean
public Node
parent()

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Return the Node that contains (and created) this Node.

public void
parent(Node node)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Set the parent to a new value.

public void
set(int index, Object obj)

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.set.

Internal method for dynamic attribute support.

Inherited from org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase:
argumentsclearHashCodeequalsexceptionsgetConstructorgetMethodreturnTypesignature

Field Detail

argsCompleteback to summary
private boolean argsComplete
bodyback to summary
private BlockStatement body
isConstructorback to summary
private boolean isConstructor

Hides org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase.isConstructor.

nodeImplback to summary
private Node nodeImpl

Constructor Detail

MethodGeneratorback to summary
pack-priv MethodGenerator(ClassGeneratorImpl parent, int modifiers, List<Type> exceptions)

Construct a MethodGenerator that represents a constructor.

MethodGeneratorback to summary
pack-priv MethodGenerator(ClassGeneratorImpl parent, int modifiers, Type rtype, String name, List<Type> exceptions)

Construct a MethodGenerator that represents a method.

Method Detail

acceptback to summary
public void accept(Visitor visitor)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.accept.

Accept the visitor and allow it to perform actions on this Node.

addArgumentback to summary
public Variable addArgument(Type type, String ident)
argsCompleteback to summary
public void argsComplete()
attributesback to summary
public List<Object> attributes()

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.attributes.

Doc from org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.attributes.

Internal method for dynamic attribute support. Return all attributes for this node (may be null).

bodyback to summary
public BlockStatement body()
copyback to summary
public <T extends Node> T copy(Class<T> cls)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

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.

copyback to summary
public <T extends Node> T copy(Node newParent, Class<T> cls)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.copy.

Copy setting a new parent in the result.

getback to summary
public Object get(int index)

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.get.

Doc from org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.get.

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.

getAncestorback to summary
public <T extends Node> T getAncestor(Class<T> type)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.getAncestor.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.getAncestor.

Return the first ancestor of this node of the given type, if any. Throws IllegalArgumentException if not found.

hashCodeback to summary
public int hashCode()

Overrides org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
idback to summary
public int id()

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.id.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.id.

Return the unique ID of this node. This starts at 1 and is incremented for each new Node that is created.

isConstructorback to summary
public boolean isConstructor()

Overrides org.glassfish.pfl.dynamic.codegen.impl.MethodInfoBase.isConstructor.

Implements org.glassfish.pfl.dynamic.codegen.spi.MethodInfo.isConstructor.

Doc from org.glassfish.pfl.dynamic.codegen.spi.MethodInfo.isConstructor.

Returns true if this is a constructor, false if method.

parentback to summary
public Node parent()

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Return the Node that contains (and created) this Node.

parentback to summary
public void parent(Node node)

Implements org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Doc from org.glassfish.pfl.dynamic.codegen.impl.Node.parent.

Set the parent to a new value. Should only be called inside NodeBase.

setback to summary
public void set(int index, Object obj)

Implements org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.set.

Doc from org.glassfish.pfl.dynamic.codegen.impl.AttributedObject.set.

Internal method for dynamic attribute support. Set the attribute at index to obj.