| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private String[] | |
| private Class | |
| private Class | |
| private Class | |
| private final SimpleCompiler | |
| private int | |
| private WarningHandler | |
| private static final Class |
| Access | Constructor and Description |
|---|---|
| public | ClassBodyEvaluator(String classBody)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(classBody);
|
| public | ClassBodyEvaluator(String fileName, InputStream is)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(fileName, is);
|
| public | ClassBodyEvaluator(String fileName, Reader reader)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(fileName, reader);
|
| public | ClassBodyEvaluator(Scanner scanner, ClassLoader parentClassLoader)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
|
| public | ClassBodyEvaluator(Scanner scanner, Class<?> extendedType, Class<?>[] implementedTypes, ClassLoader parentClassLoader)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setExtendedType(extendedType);
cbe.setImplementedTypes(implementedTypes);
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
|
| public | ClassBodyEvaluator(Scanner scanner, String className, Class<?> extendedType, Class<?>[] implementedTypes, ClassLoader parentClassLoader)
Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setClassName(className);
cbe.setExtendedType(extendedType);
cbe.setImplementedTypes(implementedTypes);
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Java. | Returns: The createdJava. objectTo the given
|
| private Class | |
| public Java. | |
| protected Java. | |
| public final void | cook(String
Used when reporting errors and warnings fileName, Reader r)Implements abstract org. Implements org. Reader.
|
| public void | |
| pack-priv void | |
| private void | |
| public static Object | createFastClassBodyEvaluator(Scanner scanner, Class<?> baseType, ClassLoader parentClassLoader)
Deprecated
Use
Use createInstance(Reader) instead
createInstance(Reader) instead:
IClassBodyEvaluator cbe =
|
| public static Object | createFastClassBodyEvaluator(Scanner scanner, String className, Class<?> extendedClass, Class<?>[] implementedInterfaces, ClassLoader parentClassLoader)
Deprecated
Use
Use createInstance(Reader) instead
createInstance(Reader) instead:
IClassBodyEvaluator cbe =
|
| public Object | createInstance(Reader
Source of class body tokens reader)Implements org. Reader, then creates
and returns an instance of that class.
|
| public Map | |
| public Class | |
| public String[] | |
| pack-priv final Java. | Returns: Thedefault imports, concatenated
with the import declarations that can be parsed from the
parser
|
| protected Java. | |
| public EnumSet | Returns: A reference to the currently effective compilation options; changes to it take effect immediately
|
| public ClassBodyEvaluator | |
| public void | setClassName(String className)
Implements org. |
| public void | setCompileErrorHandler(ErrorHandler
null to restore the default behavior (throwing a CompileException)Implements org. ErrorHandler which is invoked during compilation on each error.
|
| public void | setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)
Implements org. |
| public void | setDefaultImports(String... defaultImports)
Implements org. |
| public void | setExtendedClass(Class<?> extendedType)
Implements org. |
| public void | setExtendedType(Class<?> extendedClass)
Implements org. |
| public void | setImplementedInterfaces(Class<?>[] implementedTypes)
Implements org. |
| public void | setImplementedTypes(Class<?>[] implementedInterfaces)
Implements org. |
| public void | setParentClassLoader(ClassLoader parentClassLoader)
Implements org. |
| public void | setSourceVersion(int version)
Implements org. -source command line option.
|
| public void | setTargetVersion(int version)
Implements org. -target command line option.
|
| public void | setWarningHandler(WarningHandler
null to indicate that no warnings be issuedImplements org. WarningHandler.
|
| className | back to summary |
|---|---|
| private String className | |
| defaultImports | back to summary |
|---|---|
| private String[] defaultImports | |
| extendedType | back to summary |
|---|---|
| private Class<?> extendedType
| |
| implementedTypes | back to summary |
|---|---|
| private Class<?>[] implementedTypes | |
| result | back to summary |
|---|---|
| private Class<?> result
| |
| sc | back to summary |
|---|---|
| private final SimpleCompiler sc | |
| sourceVersion | back to summary |
|---|---|
| private int sourceVersion | |
| warningHandler | back to summary |
|---|---|
| private WarningHandler warningHandler
| |
| ZERO_CLASSES | back to summary |
|---|---|
| private static final Class<?>[] ZERO_CLASSES | |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(String classBody) throws CompileException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(classBody);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(String fileName, InputStream is) throws CompileException, IOException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(fileName, is);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(String fileName, Reader reader) throws CompileException, IOException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.cook(fileName, reader);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(Scanner scanner, ClassLoader parentClassLoader) throws CompileException, IOException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(Scanner scanner, Class<?> extendedType, Class<?>[] implementedTypes, ClassLoader parentClassLoader) throws CompileException, IOException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setExtendedType(extendedType);
cbe.setImplementedTypes(implementedTypes);
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator(Scanner scanner, String className, Class<?> extendedType, Class<?>[] implementedTypes, ClassLoader parentClassLoader) throws CompileException, IOException Equivalent to
ClassBodyEvaluator cbe = new ClassBodyEvaluator();
cbe.setClassName(className);
cbe.setExtendedType(extendedType);
cbe.setImplementedTypes(implementedTypes);
cbe.setParentClassLoader(parentClassLoader);
cbe.cook(scanner);
| |
| ClassBodyEvaluator | back to summary |
|---|---|
| public ClassBodyEvaluator() | |
| addPackageMemberClassDeclaration | back to summary |
|---|---|
| protected Java. To the given
| |
| assertCooked | back to summary |
|---|---|
| private Class | |
| classesToTypes | back to summary |
|---|---|
| public Java. | |
| classToType | back to summary |
|---|---|
| protected Java. | |
| cook | back to summary |
|---|---|
| public final void cook(String fileName, Reader r) throws CompileException, IOException Implements abstract org. Implements org. Doc from org. Reads, scans, parses and compiles Java tokens from the given | |
| cook | back to summary |
|---|---|
| public void cook(Scanner scanner) throws CompileException, IOException | |
| cook | back to summary |
|---|---|
| pack-priv void cook(Java. | |
| cook2 | back to summary |
|---|---|
| private void cook2(Scanner scanner) throws CompileException, IOException | |
| createFastClassBodyEvaluator | back to summary |
|---|---|
| public static Object createFastClassBodyEvaluator(Scanner scanner, Class<?> baseType, ClassLoader parentClassLoader) throws CompileException, IOException
Deprecated Use Use
IClassBodyEvaluator cbe =
| |
| createFastClassBodyEvaluator | back to summary |
|---|---|
| public static Object createFastClassBodyEvaluator(Scanner scanner, String className, Class<?> extendedClass, Class<?>[] implementedInterfaces, ClassLoader parentClassLoader) throws CompileException, IOException
Deprecated Use Use
IClassBodyEvaluator cbe =
| |
| createInstance | back to summary |
|---|---|
| public Object createInstance(Reader reader) throws CompileException, IOException Implements org. Doc from org. Scans, parses and compiles a class body from the tokens delivered by the the given | |
| getBytecodes | back to summary |
|---|---|
| public Map Implements org.
| |
| getClazz | back to summary |
|---|---|
| public Class Implements org.
| |
| getDefaultImports | back to summary |
|---|---|
| public String[] getDefaultImports() Implements org.
| |
| makeImportDeclarations | back to summary |
|---|---|
pack-priv final Java.
| |
| optionalClassToType | back to summary |
|---|---|
protected Java.
| |
| options | back to summary |
|---|---|
public EnumSet
| |
| options | back to summary |
|---|---|
| public ClassBodyEvaluator options(EnumSet<JaninoOption> options) Sets the options for all future compilations. | |
| setClassName | back to summary |
|---|---|
| public void setClassName(String className) Implements org. Doc from org. Sets the name of the generated class. Defaults to One reason to use this function is to have a class name in a non-default package, which can be relevant when types and members with DEFAULT accessibility are accessed.
| |
| setCompileErrorHandler | back to summary |
|---|---|
| public void setCompileErrorHandler(ErrorHandler compileErrorHandler) Implements org. Doc from org. Installs an
If the given
If the given
In other words: The
| |
| setDebuggingInformation | back to summary |
|---|---|
| public void setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars) Implements org. Doc from org. Determines what kind of debugging information is included in the generates classes. The default is typically
"
| |
| setDefaultImports | back to summary |
|---|---|
| public void setDefaultImports(String... defaultImports) Implements org. Doc from org. "Default imports" add to the system import "java.lang", i.e. the evaluator may refer to classes imported by default imports without having to explicitly declare IMPORT statements. Notice that JDK 5 "static imports" are also supported, as shown here:
sc.setDefaultImports(
"java.util.Map", // Single type import
"java.io.*", // Type-import-on-demand
"static java.util.Collections.EMPTY_MAP", // Single static import
"static java.util.Collections.*", // Static-import-on-demand
);
| |
| setExtendedClass | back to summary |
|---|---|
| public void setExtendedClass(Class<?> extendedType) Implements org. Doc from org. Sets a particular superclass that the generated class will extend. If extendedClass is The usual reason to set a base class for an evaluator is that the generated class can directly access the superclass's (non-private) members.
| |
| setExtendedType | back to summary |
|---|---|
| public void setExtendedType(Class<?> extendedClass) Implements org.
| |
| setImplementedInterfaces | back to summary |
|---|---|
| public void setImplementedInterfaces(Class<?>[] implementedTypes) Implements org. Doc from org. Sets a particular set of interfaces that the generated class will implement.
| |
| setImplementedTypes | back to summary |
|---|---|
| public void setImplementedTypes(Class<?>[] implementedInterfaces) Implements org.
| |
| setParentClassLoader | back to summary | ||||||
|---|---|---|---|---|---|---|---|
| public void setParentClassLoader(ClassLoader parentClassLoader) Implements org. Doc from org. The "parent class loader" is used to load referenced classes. Useful values are:
The parent class loader defaults to the current thread's context class loader.
| |||||||
| setSourceVersion | back to summary |
|---|---|
| public void setSourceVersion(int version) Implements org. Doc from org. Specifies the version of source code accepted, in analogy with JAVAC's
| |
| setTargetVersion | back to summary |
|---|---|
| public void setTargetVersion(int version) Implements org. Doc from org. Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's
| |
| setWarningHandler | back to summary |
|---|---|
| public void setWarningHandler(WarningHandler warningHandler) Implements org. Doc from org. By default, warnings are discarded, but an application my install a custom
| |