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

public final Class ClassGeneratorImpl

extends ClassInfoBase
implements ClassGenerator, Node
Class Inheritance
All Implemented Interfaces
org.glassfish.pfl.dynamic.codegen.impl.Node, org.glassfish.pfl.dynamic.codegen.impl.AttributedObject, org.glassfish.pfl.dynamic.codegen.spi.ClassGenerator, org.glassfish.pfl.dynamic.codegen.spi.ClassInfo
Imports
java.util.ArrayList, .HashSet, .List, .Set, org.glassfish.pfl.dynamic.codegen.spi.ClassGenerator, .MethodInfo, .Type

Class used to generate a description of a class or interface. An interface is an abstract class, all of whose methods are abstract. Interfaces do not have a super class, an initializer, or constructors. Interfaces also do not have variables.

Note

the hashCode of a ClassGeneratorImpl changes whenever a method, constructor, or field is added, so do not put ClassGenerators into sets or maps unless they are fully populated.

Field Summary

Modifier and TypeField and Description
private List<MethodGenerator>
private List<FieldGenerator>
private BlockStatement
private List<MethodGenerator>
private Node

Constructor Summary

AccessConstructor and Description
pack-priv
ClassGeneratorImpl(int modifiers, String name, List<Type> impls)

Construct a ClassGeneratorImpl representing an interface.

pack-priv
ClassGeneratorImpl(int modifiers, String name, Type superType, List<Type> impls)

Construct a ClassGeneratorImpl representing a class.

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 FieldGenerator
addField(int modifiers, Type type, String name)

public List<Object>
attributes()

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

Internal method for dynamic attribute support.

public Set<MethodInfo>
public List<MethodGenerator>
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 List<FieldGenerator>
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
id()

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

Return the unique ID of this node.

public BlockStatement
public void
public List<MethodGenerator>
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.

public MethodGenerator
startConstructor(int modifiers, List<Type> exceptions)

public MethodGenerator
startMethod(int modifiers, Type rtype, String name, List<Type> exceptions)

Inherited from org.glassfish.pfl.dynamic.codegen.impl.ClassInfoBase:
addConstructorInfoaddFieldInfoaddMethodInfoclassNameequalsfieldInfofindConstructorInfofindFieldInfofindMethodInfohashCodeimplsinitializeClassinitializeInterfaceisInterfaceisSubclassmethodInfoByNamemodifiersnamepkgNamesuperTypethisTypetoString

Field Detail

constructorsback to summary
private List<MethodGenerator> constructors

Hides org.glassfish.pfl.dynamic.codegen.impl.ClassInfoBase.constructors.

fieldsback to summary
private List<FieldGenerator> fields

Hides org.glassfish.pfl.dynamic.codegen.impl.ClassInfoBase.fields.

initializerback to summary
private BlockStatement initializer
methodsback to summary
private List<MethodGenerator> methods
nodeImplback to summary
private Node nodeImpl

Constructor Detail

ClassGeneratorImplback to summary
pack-priv ClassGeneratorImpl(int modifiers, String name, List<Type> impls)

Construct a ClassGeneratorImpl representing an interface.

ClassGeneratorImplback to summary
pack-priv ClassGeneratorImpl(int modifiers, String name, Type superType, List<Type> impls)

Construct a ClassGeneratorImpl representing a class.

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.

addFieldback to summary
public FieldGenerator addField(int modifiers, Type type, String name)
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).

constructorInfoback to summary
public Set<MethodInfo> constructorInfo()

Overrides org.glassfish.pfl.dynamic.codegen.impl.ClassInfoBase.constructorInfo.

Implements org.glassfish.pfl.dynamic.codegen.spi.ClassInfo.constructorInfo.

constructorsback to summary
public List<MethodGenerator> constructors()
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.

fieldsback to summary
public List<FieldGenerator> fields()
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.

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.

initializerback to summary
public BlockStatement initializer()
methodCompleteback to summary
public void methodComplete(MethodGenerator mg)
methodsback to summary
public List<MethodGenerator> methods()
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.

startConstructorback to summary
public MethodGenerator startConstructor(int modifiers, List<Type> exceptions)
startMethodback to summary
public MethodGenerator startMethod(int modifiers, Type rtype, String name, List<Type> exceptions)