|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dante.extex.interpreter.type.AbstractCode
de.dante.extex.interpreter.primitives.dynamic.java.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{de.dante.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 de.dante.extex.interpreter.contect.Context; import de.dante.extex.interpreter.primitives.dynamic.java.Loadable; import de.dante.extex.typesetter.Typesetter; import de.dante.util.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(java.lang.String codeName)
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. |
void |
load(Context context,
TokenSource source,
Typesetter typesetter)
Perform a load operation. |
Methods inherited from class de.dante.extex.interpreter.type.AbstractCode |
enableLocalization, getLocalizer, getName, isIf, isOuter, printable, printableControlSequence, readResolve, setName, toString |
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(java.lang.String codeName)
codeName
- the name for debuggingMethod Detail |
public void execute(Flags prefix, Context context, TokenSource source, Typesetter typesetter) throws InterpreterException
Code
execute
in interface Code
execute
in class AbstractCode
InterpreterException
Code.execute(
de.dante.extex.interpreter.Flags,
de.dante.extex.interpreter.context.Context,
de.dante.extex.interpreter.TokenSource,
de.dante.extex.typesetter.Typesetter)
public void load(Context context, TokenSource source, Typesetter typesetter) throws InterpreterException
Loader
load
in interface Loader
context
- the interpreter contextsource
- the source for new tokenstypesetter
- the typesetter
InterpreterException
- in case of an errorLoader.load(
de.dante.extex.interpreter.context.Context,
de.dante.extex.interpreter.TokenSource,
de.dante.extex.typesetter.Typesetter)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |