Class ModelReferencePayload
java.lang.Object
org.javarosa.core.model.instance.utils.ModelReferencePayload
- All Implemented Interfaces:
IDataPayload,Externalizable
public class ModelReferencePayload extends Object implements IDataPayload
The ModelReferencePayload essentially provides a wrapper functionality
around a ModelTree to allow it to be used as a payload, but only to
actually perform the various computationally expensive functions
of serialization when required.
- Author:
- Clayton Sims
-
Field Summary
Fields inherited from interface org.javarosa.core.services.transport.payload.IDataPayload
PAYLOAD_TYPE_HEADER, PAYLOAD_TYPE_JPG, PAYLOAD_TYPE_MULTI, PAYLOAD_TYPE_SMS, PAYLOAD_TYPE_TEXT, PAYLOAD_TYPE_XML -
Constructor Summary
Constructors Constructor Description ModelReferencePayload()ModelReferencePayload(int modelRecordId) -
Method Summary
Modifier and Type Method Description <T> Taccept(IDataPayloadVisitor<T> visitor)Visitor pattern accept method.StringgetDestination()longgetLength()StringgetPayloadId()InputStreamgetPayloadStream()Gets the stream for this payload.intgetPayloadType()intgetTransportId()voidreadExternal(DataInputStream in, PrototypeFactory pf)voidsetDestination(String destination)voidsetSerializer(IInstanceSerializingVisitor serializer)voidwriteExternal(DataOutputStream out)
-
Constructor Details
-
ModelReferencePayload
public ModelReferencePayload() -
ModelReferencePayload
public ModelReferencePayload(int modelRecordId)
-
-
Method Details
-
setSerializer
- Parameters:
serializer- the serializer to set
-
accept
Description copied from interface:IDataPayloadVisitor pattern accept method.- Specified by:
acceptin interfaceIDataPayload- Parameters:
visitor- The visitor to visit this payload.
-
getLength
public long getLength()- Specified by:
getLengthin interfaceIDataPayload
-
getPayloadId
- Specified by:
getPayloadIdin interfaceIDataPayload- Returns:
- A string identifying the contents of the payload
-
getPayloadStream
Description copied from interface:IDataPayloadGets the stream for this payload.- Specified by:
getPayloadStreamin interfaceIDataPayload- Returns:
- A stream for the data in this payload.
- Throws:
IOException
-
getPayloadType
public int getPayloadType()- Specified by:
getPayloadTypein interfaceIDataPayload- Returns:
- The type of the data encapsulated by this payload.
-
readExternal
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionDeserializationException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
getTransportId
public int getTransportId()- Specified by:
getTransportIdin interfaceIDataPayload- Returns:
- A unique Id for the transport manager to use to be able to identify the status of transmissions related to this payload
-
setDestination
-
getDestination
-