Class InvokeMessageCompiler

  • All Implemented Interfaces:
    IMessageCompiler

    public final class InvokeMessageCompiler
    extends java.lang.Object
    implements IMessageCompiler
    Generates a InvokeMessageType to serialize/de-serialize a specific EMessage or EField class. InvokeMessageType uses java.lang.invoke package to access the message object fields and the message object's builder class.

    In terms of performance InvokeMessageType serialization/de-serialization can be thought of running in interpreted mode. Compare this with JavaMessageCompiler which dynamically generates and compiles a class specifically for serializing/de-serializing the target message class. This can be thought of as JIT'd code.

    JavaMessageCompiler is the default message compiler which uses javassist to generate Java code at run-time. If javassist is unavailable or cannot be used, then an application must set the message compiler type at application start. This is done by setting the property messageCompiler = JAVA_INVOKE in an eBus configuration file and then passing that file in the command line option -Dnet.sf.eBus.config.jsonFile=<file>.

    Note: when running on an Android virtual machine the InvokeMessageCompiler is always used since it is not feasible to generate and load a Java class at run-time given Android security restrictions.

    Author:
    Charles W. Rapp
    See Also:
    JavaMessageCompiler, DataType