public interface ScriptSerializable
class MyObject {
private Connection deviceConection;
public void sendCommandToDevice(String command) {
deviceConection.send(command);
}
}
In this example, the object needs a connection to the device to be able to interpret the sendCommandToDevice
method. Such a connection might not be possible to be instantiated in an empty constructor,
but needs to be taken somehow from a the mPRM runtime.
For this purpose, the Rule Engine supports a mechanism for delegating the serialization and deserialization
of such objects to a dedicated services - ScriptSerializer-s, registered in the OSGi Service registry on the mPRM backend.
To link a ScriptSerializable object to a ScriptSerializer service, the
getScriptSerializerType() of the ScriptSerializable object must match the
ScriptSerializer.SERIALIZER_TYPE registration property of the ScriptSerializer service.
myObject = myScriptService.getMyObject(......);
Closure c = {myObject.sendCommand("command-2")}
myObject.sendCommand("command-1", c);
java.io.Serializable, or
com.prosyst.util.io.Externalizable.| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getScriptSerializerType()
Returns the serializer-type for this object.
|
java.lang.String getScriptSerializerType()
ScriptSerializer service service,
designated by its ScriptSerializer.SERIALIZER_TYPE registration property,
that will do the object serialization.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.