Class InvokeMessageCompiler
- java.lang.Object
-
- net.sf.eBus.messages.type.InvokeMessageCompiler
-
- All Implemented Interfaces:
IMessageCompiler
public final class InvokeMessageCompiler extends java.lang.Object implements IMessageCompiler
Generates aInvokeMessageTypeto serialize/de-serialize a specificEMessageorEFieldclass.InvokeMessageTypeusesjava.lang.invokepackage to access the message object fields and the message object's builder class.In terms of performance
InvokeMessageTypeserialization/de-serialization can be thought of running in interpreted mode. Compare this withJavaMessageCompilerwhich dynamically generates and compiles a class specifically for serializing/de-serializing the target message class. This can be thought of as JIT'd code.JavaMessageCompileris the default message compiler which usesjavassistto generate Java code at run-time. Ifjavassistis unavailable or cannot be used, then an application must set the message compiler type at application start. This is done by setting the propertymessageCompiler = JAVA_INVOKEin 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
InvokeMessageCompileris 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
-
-
Constructor Summary
Constructors Constructor Description InvokeMessageCompiler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataTypecompile(ConcreteMessageType mt)Returns a specificInvokeMessageTypefor serializing/de-serializing the given message type.
-
-
-
Method Detail
-
compile
public DataType compile(ConcreteMessageType mt) throws MessageCompileException
Returns a specificInvokeMessageTypefor serializing/de-serializing the given message type. The returned message type usesjava.lang.invoketo access message fields when serializing and message builder methods when de-serializing. The returned data type performs serialization/de-serialization notably slower than the data type returned byJavaMessageCompiler.compile(ConcreteMessageType).- Specified by:
compilein interfaceIMessageCompiler- Parameters:
mt- createInvokeMessageCompilerfor this eBus message or field type.- Returns:
InvokeMessageCompilerfor the given message type.- Throws:
MessageCompileException- if specific data type formtcould not be generated.- See Also:
JavaMessageCompiler
-
-