C# Class Rhino.Optimizer.ClassCompiler

Generates class files from script sources.
Generates class files from script sources. since 1.5 Release 5
Datei anzeigen Open project: hazzik/Rhino.Net Class Usage Examples

Public Methods

Method Description
ClassCompiler ( CompilerEnvirons compilerEnv ) : System

Construct ClassCompiler that uses the specified compiler environment when generating classes.

Construct ClassCompiler that uses the specified compiler environment when generating classes.

CompileToClassFiles ( string source, string sourceLocation, int lineno, string mainClassName ) : object[]

Compile JavaScript source into one or more Java class files.

Compile JavaScript source into one or more Java class files. The first compiled class will have name mainClassName. If the results of GetTargetExtends() or GetTargetImplements() are not null, then the first compiled class will extend the specified super class and implement specified interfaces.

GetCompilerEnv ( ) : CompilerEnvirons

Get the compiler environment the compiler uses.

Get the compiler environment the compiler uses.

GetMainMethodClass ( ) : string

Get the name of the class for main method implementation.

Get the name of the class for main method implementation.

GetTargetExtends ( ) : Type

Get the class that the generated target will extend.

Get the class that the generated target will extend.

GetTargetImplements ( ) : System.Type[]

Get the interfaces that the generated target will implement.

Get the interfaces that the generated target will implement.

SetMainMethodClass ( string className ) : void

Set the class name to use for main method implementation.

Set the class name to use for main method implementation. The class must have a method matching public static void main(Script sc, String[] args), it will be called when main(String[] args) is called in the generated class. The class name should be fully qulified name and include the package name like in org.foo.Bar.

SetTargetExtends ( Type extendsClass ) : void

Set the class that the generated target will extend.

Set the class that the generated target will extend.

SetTargetImplements ( Type implementsClasses ) : void

Set the interfaces that the generated target will implement.

Set the interfaces that the generated target will implement.

Protected Methods

Method Description
MakeAuxiliaryClassName ( string mainClassName, string auxMarker ) : string

Build class name for a auxiliary class generated by compiler.

Build class name for a auxiliary class generated by compiler. If the compiler needs to generate extra classes beyond the main class, it will call this function to build the auxiliary class name. The default implementation simply appends auxMarker to mainClassName but this can be overridden.

Method Details

ClassCompiler() public method

Construct ClassCompiler that uses the specified compiler environment when generating classes.
Construct ClassCompiler that uses the specified compiler environment when generating classes.
public ClassCompiler ( CompilerEnvirons compilerEnv ) : System
compilerEnv Rhino.CompilerEnvirons
return System

CompileToClassFiles() public method

Compile JavaScript source into one or more Java class files.
Compile JavaScript source into one or more Java class files. The first compiled class will have name mainClassName. If the results of GetTargetExtends() or GetTargetImplements() are not null, then the first compiled class will extend the specified super class and implement specified interfaces.
public CompileToClassFiles ( string source, string sourceLocation, int lineno, string mainClassName ) : object[]
source string
sourceLocation string
lineno int
mainClassName string
return object[]

GetCompilerEnv() public method

Get the compiler environment the compiler uses.
Get the compiler environment the compiler uses.
public GetCompilerEnv ( ) : CompilerEnvirons
return Rhino.CompilerEnvirons

GetMainMethodClass() public method

Get the name of the class for main method implementation.
Get the name of the class for main method implementation.
public GetMainMethodClass ( ) : string
return string

GetTargetExtends() public method

Get the class that the generated target will extend.
Get the class that the generated target will extend.
public GetTargetExtends ( ) : Type
return System.Type

GetTargetImplements() public method

Get the interfaces that the generated target will implement.
Get the interfaces that the generated target will implement.
public GetTargetImplements ( ) : System.Type[]
return System.Type[]

MakeAuxiliaryClassName() protected method

Build class name for a auxiliary class generated by compiler.
Build class name for a auxiliary class generated by compiler. If the compiler needs to generate extra classes beyond the main class, it will call this function to build the auxiliary class name. The default implementation simply appends auxMarker to mainClassName but this can be overridden.
protected MakeAuxiliaryClassName ( string mainClassName, string auxMarker ) : string
mainClassName string
auxMarker string
return string

SetMainMethodClass() public method

Set the class name to use for main method implementation.
Set the class name to use for main method implementation. The class must have a method matching public static void main(Script sc, String[] args), it will be called when main(String[] args) is called in the generated class. The class name should be fully qulified name and include the package name like in org.foo.Bar.
public SetMainMethodClass ( string className ) : void
className string
return void

SetTargetExtends() public method

Set the class that the generated target will extend.
Set the class that the generated target will extend.
public SetTargetExtends ( Type extendsClass ) : void
extendsClass System.Type the class it extends
return void

SetTargetImplements() public method

Set the interfaces that the generated target will implement.
Set the interfaces that the generated target will implement.
public SetTargetImplements ( Type implementsClasses ) : void
implementsClasses System.Type /// an array of Class objects, one for each /// interface the target will extend ///
return void