Package com.sun.ejb.codegen
Class Generator
java.lang.Object
com.sun.ejb.codegen.Generator
- Direct Known Subclasses:
GenericHomeGenerator,Remote30WrapperGenerator,RemoteGenerator,ServiceInterfaceGenerator
The base class for all code generators.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidCallsWrappermethods to configure the class definition.Class<?>generate()Generates the bytecode of the configured class with the usage of the PFL tool.protected abstract Class<?>static StringgetBaseName(String fullClassName) static StringgetFullClassName(String packageName, String baseName) Returns full qualified class name.abstract Stringprotected abstract Stringstatic StringgetPackageName(String fullClassName) protected Method[]removeRedundantMethods(Method[] methods) Remove duplicates from method array.
-
Constructor Details
-
Generator
- Parameters:
loader-ClassLoaderowning generated classes
-
-
Method Details
-
getPackageName
- Returns:
- the name of the package of the generated class.
-
getGeneratedClassName
- Returns:
- name of the generated class or interface
-
getAnchorClass
- Returns:
- loadable class of the same package as
getGeneratedClassName()
-
defineClassBody
protected abstract void defineClassBody()CallsWrappermethods to configure the class definition. TheWrapperusesThreadLocalinternally, so you should always callWrapper._clear()in finally block after generation to avoid leakages. -
getClassLoader
- Returns:
ClassLoaderowning the generated class.
-
generate
Generates the bytecode of the configured class with the usage of the PFL tool. Then usesMethodHandlesorClassGeneratorto generate the class.WARNING: This selection depends on the classloader capabilities and JVM rules, which change between JDK versions.
- Returns:
Class- Throws:
IllegalAccessException- if a reflective access error occurred
-
getPackageName
- Returns:
- the package name.
-
getBaseName
- Returns:
- simple class name (including wrapper class and dollar sign if it is internal class)
-
getFullClassName
Returns full qualified class name.- Parameters:
packageName- the package namebaseName- the base (simple) class name- Returns:
- the full qualified class name
-
removeRedundantMethods
Remove duplicates from method array.Duplicates will arise if a class/intf and super-class/intf define methods with the same signature. Potentially the throws clauses of the methods may be different (note Java requires that the superclass/intf method have a superset of the exceptions in the derived method).
- Parameters:
methods- the methods array without duplicates- Returns:
- methods which can be generated in an interface
-