Package org.javarosa.core.model
Interface IAnswerDataSerializer
- All Known Implementing Classes:
XFormAnswerDataSerializer
public interface IAnswerDataSerializer
An IAnswerDataSerializer returns an object that can be serialized
into some external storage format, IE: XForm, from an AnswerData
object. Each serializer is responsible for identifying what
implementations of AnswerData it is able to serialize properly.
Additionally, each serialzer is responsible for extending the types
that it can serialize by registering other serializers.
- Author:
- Clayton Sims
-
Method Summary
Modifier and Type Method Description booleancanSerialize(IAnswerData element)Identifies whether this serializer can turn the AnswerData object inside of the given element into an external format.BooleancontainsExternalData(IAnswerData data)Identifies whether an answer data object contains data that needs to be extracted to be handled differently than the serialized answer data.voidregisterAnswerSerializer(IAnswerDataSerializer ads)Extends the serializing capabilities of this serializer by registering another, and allowing this serializer to operate on all of the data types that the argument can.IDataPointer[]retrieveExternalDataPointer(IAnswerData data)Retrieves a pointer to external data contained in the provided answer data, if one exists.ObjectserializeAnswerData(IAnswerData data)Serializes the given data object into a format that can be stored externally.ObjectserializeAnswerData(IAnswerData data, int dataType)Serializes the given data object into a format that can be stored externally using the defined schemas
-
Method Details
-
canSerialize
Identifies whether this serializer can turn the AnswerData object inside of the given element into an external format.- Parameters:
element- The element whose data is to be serialzed- Returns:
- true if this can meaningfully serialze the provided object. false otherwise
-
serializeAnswerData
Serializes the given data object into a format that can be stored externally using the defined schemas- Parameters:
element- The element whose data is to be serialzedschema- the schema containing the necessary bindings to determine the elements data type- Returns:
- An implementation-specific representation of the given object if canSerialize() would return true for that object. False otherwise.
-
serializeAnswerData
Serializes the given data object into a format that can be stored externally.- Parameters:
data- The element whose data is to be serialzed- Returns:
- An implementation-specific representation of the given object if canSerialize() would return true for that object. False otherwise.
-
registerAnswerSerializer
Extends the serializing capabilities of this serializer by registering another, and allowing this serializer to operate on all of the data types that the argument can.- Parameters:
ads- An IAnswerDataSerializer
-
containsExternalData
Identifies whether an answer data object contains data that needs to be extracted to be handled differently than the serialized answer data.- Parameters:
data- The answer data that should be checked.- Returns:
- True if this data contains information that can be extracted. False if it does not. Null if this serializer cannot process the data type.
-
retrieveExternalDataPointer
Retrieves a pointer to external data contained in the provided answer data, if one exists.- Parameters:
data- The answer data that contains the pointer. containsExternalData should return true for this data.- Returns:
- An IDataPointer to an external piece of data that couldn't (or shouldn't) be serialized directly. Null if containsExternalData() does not return true for this answer data.
-