Class JavaLoad

  extended byde.dante.extex.interpreter.type.AbstractCode
All Implemented Interfaces:
Code, Loader, Localizable,

public class JavaLoad
extends AbstractCode
implements Loader

This primitive initiates the loading of Java code and implements the primitive \javaload

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 ExTeX in one junk. There is no need to declare each single macro with \javadef.


The general form of this primitive is
       → \javaload ⟨tokens⟩  

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 init() is invoked. The instantiation requires the empty constructor to be visible.


The following example illustrates the use of this primitive:


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.typesetter.Typesetter;
   import de.dante.util.GeneralException;

   class MyModule implements Loadable {

     public MyModule() {
       // initialization code – if required

     public void init(final Context context,
                      final Typesetter typesetter
                     ) throws GeneralException {
       // implement the initialization code here

$Revision: 1.23 $
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
Constructor Summary
          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
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail


public JavaLoad()
Creates a new object. This method is needed for the nativeload wrapper.


public JavaLoad(java.lang.String codeName)
Creates a new object.

codeName - the name for debugging
Method Detail


public void execute(Flags prefix,
                    Context context,
                    TokenSource source,
                    Typesetter typesetter)
             throws InterpreterException
Description copied from interface: Code
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.

Specified by:
execute in interface Code
execute in class AbstractCode
See Also:
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
Description copied from interface: Loader
Perform a load operation.

Specified by:
load in interface Loader
context - the interpreter context
source - the source for new tokens
typesetter - the typesetter
InterpreterException - in case of an error
See Also:
Loader.load( de.dante.extex.interpreter.context.Context, de.dante.extex.interpreter.TokenSource, de.dante.extex.typesetter.Typesetter)