|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TranslatorInterface
The TranslatorInterface
is the interface by which new
classes can be created and loaded into the runtime system.
The runtime system (per isolate) can have at most one open connection with a translator (i.e. an object that implements this interface). The correct usage of a translator is described by the following state transistion machine:
+----------- open() ----------+ +---------+ | | | | | V V | +--------+ +---------+ | ---> | CLOSED | | OPEN | load() / convert() +--------+ +---------+ | ^ | | | | | | | +---------- close() ----------+ +---------+
That is, a translator can be opened
and then have any
number of load(com.sun.squawk.Klass)
and convert(com.sun.squawk.Klass)
operations
performed on it before being closed
.
Method Summary | |
---|---|
void |
close(int type)
Closes the connection with the translator. |
void |
convert(Klass klass)
Ensures that all the methods (if any) in a given class have been verified and converted to Squawk bytecodes. |
String |
getLastClassName()
For error recovery, you can get the name of the last class that was processed. |
byte[] |
getResourceData(String name)
Get the bytes for the resource named name . |
boolean |
isOption(String arg)
If arg represents a valid translator argument, then return true. |
boolean |
isValidClassName(String name)
Determines if a given name is a valid class name according the JVM specification. |
void |
load(Klass klass)
Ensures that a given class has had its definition initialized, loading it from a class file if necessary. |
void |
open(Suite suite,
String classPath)
Opens a connection with the translator to load & create classes in the context of a given suite. |
void |
printOptionProperties(PrintStream out,
boolean asParameters)
Print the usage information for the translator'soption properties to the outputstream. |
void |
printTraceFlags(PrintStream out)
Print the usage information for the translator's trace flags to the outputstream. |
boolean |
processOption(String arg)
If arg represents a valid translator argument, then process it by parsing into property name and value, and set the property value. |
Method Detail |
---|
void open(Suite suite, String classPath) throws NoClassDefFoundError
suite
- the suite in which classes created during the connection
with this translator will be installed.
NoClassDefFoundError
boolean isValidClassName(String name)
name
- the class name to test
name
is a valid class nameString getLastClassName()
void load(Klass klass) throws NoClassDefFoundError
klass
- the class whose definition must be initialized
java.lang.LinkageError
- if there were any problems while loading and linking the class
NoClassDefFoundError
void convert(Klass klass) throws NoClassDefFoundError
klass
- the class whose methods are to be verified and converted
java.lang.LinkageError
- if there were any problems while converting the class
NoClassDefFoundError
void close(int type) throws NoClassDefFoundError
suiteType
- indicates if the the translator can assume that package-private classes and member will not be accessible outside of the
the unit of translation (the suite). The value pased should be one of the constants specified in java.lang.Suite
NoClassDefFoundError
byte[] getResourceData(String name)
name
.
The first resource found by combining each classPath entry of the currently active suite
will be returned. Meaning that name
is relative to the root/default package.
name
- of the resource to fetch
name
to be found.void printTraceFlags(PrintStream out)
out
- the stream to print on.void printOptionProperties(PrintStream out, boolean asParameters)
out
- the stream to print on.asParameters
- if true, print prop as "-foo:value", instead of "-Dtranslator.foo=value"boolean processOption(String arg)
arg
represents a valid translator argument, then process it by parsing into property name and value, and set the property value.
and return true. Otherwise return false.
arg
- boolean isOption(String arg)
arg
represents a valid translator argument, then return true. Otherwise return false.
arg
-
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |