|
Web Site | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.janino.EvaluatorBase
Utilities for the various "...Evaluator" classes.
Constructor Summary | |
protected |
EvaluatorBase(ClassLoader optionalParentClassLoader)
Construct with the given ClassLoader . |
Method Summary | |
protected Java.Block |
addClassMethodBlockDeclaration(Location location,
Java.CompilationUnit compilationUnit,
String className,
Class optionalExtendedType,
Class[] implementedTypes,
boolean staticMethod,
Class returnType,
String methodName,
String[] parameterNames,
Class[] parameterTypes,
Class[] thrownExceptions)
To the given Java.CompilationUnit , add
A package member class declaration with the given name, superclass and interfaces
A public method declaration with the given return type, name, parameter
names and values and thrown exceptions
A block
|
protected Java.PackageMemberClassDeclaration |
addPackageMemberClassDeclaration(Location location,
Java.CompilationUnit compilationUnit,
String className,
Class optionalExtendedType,
Class[] implementedTypes)
To the given Java.CompilationUnit , add
A class declaration with the given name, superclass and interfaces
A method declaration with the given return type, name, parameter
names and values and thrown exceptions
|
protected Java.Type[] |
classesToTypes(Location location,
Class[] classes)
Convert an array of Class es into an array ofJava.Type s. |
protected Java.Type |
classToType(Location location,
Class optionalClass)
Wrap a reflection Class in a Java.Type object. |
protected ClassLoader |
compileAndLoad(Java.CompilationUnit compilationUnit,
DebuggingInformation debuggingInformation)
Compile the given compilation unit. |
protected Class |
compileAndLoad(Java.CompilationUnit compilationUnit,
DebuggingInformation debuggingInformation,
String newClassName)
Compile the given compilation unit, load all generated classes, and return the class with the given name. |
protected Java.FormalParameter[] |
makeFormalParameters(Location location,
String[] parameterNames,
Class[] parameterTypes)
Convert name and Class -base parameters into an array of
Java.FormalParameter s. |
protected void |
parseImportDeclarations(Java.CompilationUnit compilationUnit,
Scanner scanner)
Parse as many import declarations as possible for the given Java.CompilationUnit . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected EvaluatorBase(ClassLoader optionalParentClassLoader)
ClassLoader
.
Notice that from version 2.1.0 to 2.2.0, the parameter was renamed from
optionalClassLoader
to optionalparentClassLoader
together with an incompatible semantic change:
optionalClassLoader
was a
ByteArrayClassLoader
, the generated classes were loaded into it,
otherwise a new ByteArrayClassLoader
was created with the
optionalClassLoader
as the parent ClassLoader
.
ByteArrayClassLoader
is always created with the
optionalClassLoader
as the parent ClassLoader
.
optionalParentClassLoader
- null == use current thread's context class loaderMethod Detail |
protected void parseImportDeclarations(Java.CompilationUnit compilationUnit, Scanner scanner) throws Scanner.ScanException, Parser.ParseException, IOException
Java.CompilationUnit
.
compilationUnit
- scanner
- Source of tokens
Scanner.ScanException
Parser.ParseException
IOException
protected Java.PackageMemberClassDeclaration addPackageMemberClassDeclaration(Location location, Java.CompilationUnit compilationUnit, String className, Class optionalExtendedType, Class[] implementedTypes) throws Parser.ParseException
Java.CompilationUnit
, add
location
- compilationUnit
- className
- optionalExtendedType
- (null == Object
)implementedTypes
-
Java.ClassDeclaration
object
Parser.ParseException
protected Java.Block addClassMethodBlockDeclaration(Location location, Java.CompilationUnit compilationUnit, String className, Class optionalExtendedType, Class[] implementedTypes, boolean staticMethod, Class returnType, String methodName, String[] parameterNames, Class[] parameterTypes, Class[] thrownExceptions) throws Parser.ParseException
Java.CompilationUnit
, add
location
- compilationUnit
- className
- optionalExtendedType
- (null == Object
)implementedTypes
- staticMethod
- Whether the method should be declared "static"returnType
- Return type of the declared methodmethodName
- parameterNames
- parameterTypes
- thrownExceptions
-
Java.Block
object
Parser.ParseException
protected Java.Type classToType(Location location, Class optionalClass)
Class
in a Java.Type
object.
protected Java.Type[] classesToTypes(Location location, Class[] classes)
Class
es into an array ofJava.Type
s.
protected Java.FormalParameter[] makeFormalParameters(Location location, String[] parameterNames, Class[] parameterTypes)
Class
-base parameters into an array of
Java.FormalParameter
s.
protected ClassLoader compileAndLoad(Java.CompilationUnit compilationUnit, DebuggingInformation debuggingInformation) throws CompileException
compilationUnit
- The parsed compilation unitdebuggingInformation
- What kind of debugging information to generate in the class file
ClassLoader
into which the compiled classes were defined
CompileException
protected Class compileAndLoad(Java.CompilationUnit compilationUnit, DebuggingInformation debuggingInformation, String newClassName) throws CompileException, ClassNotFoundException
compilationUnit
- debuggingInformation
- TODOnewClassName
- The fully qualified class name
CompileException
ClassNotFoundException
- A class with the given name was not declared in the compilation unit
|
Web Site | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |