|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.interpreter.type.AbstractCode
org.extex.unit.dynamic.java.JavaLoad
public class JavaLoad
This primitive initiates the loading of Java code and implements the
primitive \javaload.
The primitive \javaload loads a java class and invokes its
init() method. With this method it is possible to load larger
extensions of
The 〈tokens〉 is any specification of a list of tokens like
a constant list enclosed in braces or a token register. The value of these
tokens are taken and interpreted as the name of a Java class. This class is
loaded if needed, instantiated, and its method
The following example illustrates the use of this primitive:
The Primitive \javaload
Syntax
The general form of this primitive is
〈javaload〉
→ \javaload 〈tokens〉
init() is invoked. The instantiation requires the empty constructor to be
visible.
Examples
\javaload{org.extex.extensions.Basic}
For the loading of the Java class it is necessary that this Java class
implements the interface
Loadable.
package my.package;
import org.extex.interpreter.contect.Context;
import org.extex.interpreter.primitives.dynamic.java.Loadable;
import org.extex.typesetter.Typesetter;
import org.extex.util.exception.GeneralException;
class MyModule implements Loadable {
public MyModule() {
super();
// initialization code – if required
}
public void init(final Context context,
final Typesetter typesetter
) throws GeneralException {
// implement the initialization code here
}
}
| Field Summary | |
|---|---|
protected static long |
serialVersionUID
The constant serialVersionUID contains the id for serialization. |
| Constructor Summary | |
|---|---|
JavaLoad()
Creates a new object. |
|
JavaLoad(CodeToken token)
Creates a new object. |
|
| Method Summary | |
|---|---|
void |
execute(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
This method takes the first token and executes it. The result is placed on the stack. This operation might have side effects. To execute a token it might be necessary to consume further tokens. |
void |
load(Context context,
TokenSource source,
Typesetter typesetter)
Perform a load operation. |
| Methods inherited from class org.extex.interpreter.type.AbstractCode |
|---|
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final long serialVersionUID
| Constructor Detail |
|---|
public JavaLoad()
public JavaLoad(CodeToken token)
token - the initial token for the primitive| Method Detail |
|---|
public void execute(Flags prefix,
Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
execute in interface Codeexecute in class AbstractCodeprefix - the prefix controlling the executioncontext - the interpreter contextsource - the token sourcetypesetter - the typesetter
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetterAbstractCode.execute(
org.extex.interpreter.Flags, org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)
public void load(Context context,
TokenSource source,
Typesetter typesetter)
throws HelpingException,
TypesetterException
load in interface Loadercontext - the interpreter contextsource - the source for new tokenstypesetter - the typesetter
HelpingException - in case of an error
TypesetterException - in case of an error in the typesetterLoader.load(
org.extex.interpreter.context.Context,
org.extex.interpreter.TokenSource, org.extex.typesetter.Typesetter)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||