|
Sun SPOT 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()
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. |
byte[] |
getResourceData(String name)
Get the bytes for the resource named name. |
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. |
| Method Detail |
|---|
void open(Suite suite,
String classPath)
suite - the suite in which classes created during the connection
with this translator will be installed.boolean isValidClassName(String name)
name - the class name to test
name is a valid class namevoid load(Klass klass)
klass - the class whose definition must be initialized
java.lang.LinkageError - if there were any problems while loading and linking the classvoid convert(Klass klass)
klass - the class whose methods are to be verified and converted
java.lang.LinkageError - if there were any problems while converting the classvoid close()
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.
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||