public class ClassCompiler
extends java.lang.Object
Constructor and Description |
---|
ClassCompiler(CompilerEnvirons compilerEnv)
Construct ClassCompiler that uses the specified compiler environment
when generating classes.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object[] |
compileToClassFiles(java.lang.String source,
java.lang.String sourceLocation,
int lineno,
java.lang.String mainClassName)
Compile JavaScript source into one or more Java class files.
|
CompilerEnvirons |
getCompilerEnv()
Get the compiler environment the compiler uses.
|
java.lang.String |
getMainMethodClass()
Get the name of the class for main method implementation.
|
java.lang.Class<?> |
getTargetExtends()
Get the class that the generated target will extend.
|
java.lang.Class<?>[] |
getTargetImplements()
Get the interfaces that the generated target will implement.
|
protected java.lang.String |
makeAuxiliaryClassName(java.lang.String mainClassName,
java.lang.String auxMarker)
Build class name for a auxiliary class generated by compiler.
|
void |
setMainMethodClass(java.lang.String className)
Set the class name to use for main method implementation.
|
void |
setTargetExtends(java.lang.Class<?> extendsClass)
Set the class that the generated target will extend.
|
void |
setTargetImplements(java.lang.Class<?>[] implementsClasses)
Set the interfaces that the generated target will implement.
|
public ClassCompiler(CompilerEnvirons compilerEnv)
public void setMainMethodClass(java.lang.String className)
public java.lang.String getMainMethodClass()
setMainMethodClass(String)
public CompilerEnvirons getCompilerEnv()
public java.lang.Class<?> getTargetExtends()
public void setTargetExtends(java.lang.Class<?> extendsClass)
extendsClass
- the class it extendspublic java.lang.Class<?>[] getTargetImplements()
public void setTargetImplements(java.lang.Class<?>[] implementsClasses)
implementsClasses
- an array of Class objects, one for each
interface the target will extendprotected java.lang.String makeAuxiliaryClassName(java.lang.String mainClassName, java.lang.String auxMarker)
public java.lang.Object[] compileToClassFiles(java.lang.String source, java.lang.String sourceLocation, int lineno, java.lang.String mainClassName)
getTargetExtends()
or
getTargetImplements()
are not null, then the first compiled
class will extend the specified super class and implement
specified interfaces.