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

public final Class CodeGenerator

extends Object
Class Inheritance
Imports
java.io.IOException, .PrintStream, java.util.List, .Properties, org.glassfish.pfl.dynamic.codegen.spi.ImportList, .Type

Class used to define classes and interfaces, and to generator source or byte code from the resulting definitions. This is the factory for the codegen framework.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ClassGeneratorImpl
defineClass(int modifiers, String name, Type superType, List<Type> impls)

Define a ClassGeneratorImpl for a class.

public static ClassGeneratorImpl
defineInterface(int modifiers, String name, List<Type> impls)

Define a ClassGeneratorImpl for an interface.

public static byte[]
generateBytecode(ClassGeneratorImpl cg, ClassLoader cl, ImportList imports, Properties options, PrintStream debugOutput)

Convert the Java class or interface defined by ClassGeneratorImpl into an array of bytecodes.

public static void
generateSourceCode(PrintStream ps, ClassGeneratorImpl cg, ImportList imports, Properties options)

Write a source code representation of the class or interface defined by cg to the PrintStream ps.

public static void
generateSourceCode(String sdir, ClassGeneratorImpl cg, ImportList imports, Properties options)

Write a source code representation of the class or interface defined by cg to a file in the SOURCE_GENERATION_DIRECTORY specified in options.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CodeGeneratorback to summary
private CodeGenerator()

Method Detail

defineClassback to summary
public static ClassGeneratorImpl defineClass(int modifiers, String name, Type superType, List<Type> impls)

Define a ClassGeneratorImpl for a class.

defineInterfaceback to summary
public static ClassGeneratorImpl defineInterface(int modifiers, String name, List<Type> impls)

Define a ClassGeneratorImpl for an interface.

generateBytecodeback to summary
public static byte[] generateBytecode(ClassGeneratorImpl cg, ClassLoader cl, ImportList imports, Properties options, PrintStream debugOutput)

Convert the Java class or interface defined by ClassGeneratorImpl into an array of bytecodes.

generateSourceCodeback to summary
public static void generateSourceCode(PrintStream ps, ClassGeneratorImpl cg, ImportList imports, Properties options) throws IOException

Write a source code representation of the class or interface defined by cg to the PrintStream ps.

generateSourceCodeback to summary
public static void generateSourceCode(String sdir, ClassGeneratorImpl cg, ImportList imports, Properties options) throws IOException

Write a source code representation of the class or interface defined by cg to a file in the SOURCE_GENERATION_DIRECTORY specified in options.