|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.janino.EvaluatorBase | +--net.janino.ClassBodyEvaluator
Parses a class body and returns it as a java.lang.Class object ready for use with java.lang.reflect.
Example:
import java.util.*; static private int a = 1; private int b = 2; public void func(int c, int d) { return func2(c, d); } private static void func2(int e, int f) { return e * f; }
Constructor Summary | |
ClassBodyEvaluator(Scanner scanner,
java.lang.Class extendedType,
java.lang.Class[] implementedTypes,
java.lang.ClassLoader classLoader)
See ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader) . |
|
ClassBodyEvaluator(Scanner scanner,
java.lang.ClassLoader classLoader)
See ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader) . |
|
ClassBodyEvaluator(Scanner scanner,
java.lang.String className,
java.lang.Class extendedType,
java.lang.Class[] implementedTypes,
java.lang.ClassLoader classLoader)
Parse and compile a class body, i.e. a series of member definitions. |
|
ClassBodyEvaluator(java.lang.String script)
See ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader) . |
|
ClassBodyEvaluator(java.lang.String fileName,
java.io.InputStream is)
See ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader) . |
|
ClassBodyEvaluator(java.lang.String fileName,
java.io.Reader reader)
See ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader) . |
Method Summary | |
java.lang.Class |
evaluate()
Returns the java.lang.Class object compiled from the class body. |
Methods inherited from class net.janino.EvaluatorBase |
addClassDeclaration, addClassMethodBlockDeclaration, classesToTypes, classToType, compileAndLoad, compileAndLoad, makeFormalParameters, parseImportDeclarations |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassBodyEvaluator(java.lang.String script) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader)
.public ClassBodyEvaluator(java.lang.String fileName, java.io.InputStream is) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader)
.public ClassBodyEvaluator(java.lang.String fileName, java.io.Reader reader) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader)
.public ClassBodyEvaluator(Scanner scanner, java.lang.ClassLoader classLoader) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader)
.public ClassBodyEvaluator(Scanner scanner, java.lang.Class extendedType, java.lang.Class[] implementedTypes, java.lang.ClassLoader classLoader) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
ClassBodyEvaluator(Scanner, String, Class, Class[], ClassLoader classLoader)
.public ClassBodyEvaluator(Scanner scanner, java.lang.String className, java.lang.Class extendedType, java.lang.Class[] implementedTypes, java.lang.ClassLoader classLoader) throws Java.CompileException, Parser.ParseException, Scanner.ScanException, java.io.IOException
The "classLoader" serves two purposes:
ByteArrayClassLoader
, or by creation of a temporary
ByteArrayClassLoader
if not.
String
, an InputStream
or a Reader
instead of a Scanner
.scanner
- source of tokensclassName
- the name of the temporary class (uncritical)extendedType
- class to extend or nullimplementedTypes
- interfaces to implementclassLoader
- loads referenced classes and defines the generated classMethod Detail |
public java.lang.Class evaluate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |