|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectTransformer
Interface that describes the Skaringa transformer.
Method Summary | |
---|---|
java.lang.Object |
deserialize(javax.xml.transform.Source src)
Deserializes an Object from a Source using XML format. |
java.lang.Object |
deserializeFromJson(java.io.InputStream stream)
Deserializes a List or Map from a stream using JSON format. |
java.lang.Object |
deserializeFromJson(java.io.InputStream stream,
java.lang.Class rootType)
Deserializes an Object from a stream using JSON format. |
java.lang.Object |
deserializeFromJsonString(java.lang.String s)
Deserializes a List or Map from a String using JSON format. |
java.lang.Object |
deserializeFromJsonString(java.lang.String s,
java.lang.Class rootType)
Deserializes an Object from a String using JSON format. |
java.lang.Object |
deserializeFromString(java.lang.String s)
Deserializes an Object from a string using XML format. |
void |
serialize(java.lang.Object obj,
javax.xml.transform.Result result)
Serializes an Object into a result using XML format. |
void |
serializeToJson(java.lang.Object obj,
java.io.OutputStream stream)
Serializes an object into a stream using JSON format. |
java.lang.String |
serializeToJsonString(java.lang.Object obj)
Serializes an object into a String using JSON format. |
java.lang.String |
serializeToString(java.lang.Object obj)
Serializes an Object into a String using XML format. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader used to load classes during deserialization. |
void |
setPostprocessorInstruction(javax.xml.transform.Source transformationInstruction)
Set the stylesheet to be used for postprocessing. |
void |
setPreprocessorInstruction(javax.xml.transform.Source transformationInstruction)
Set the instructions to be used for preprocessing. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set a transformer property. |
java.lang.Object |
transform(java.lang.Object in)
Transform one object into another using pre-parsed transformation instructions. |
java.lang.Object |
transform(java.lang.Object in,
javax.xml.transform.Source instructionSrc)
Deprecated. Use setPostprocessorInstruction(Source) and
transform(Object) . |
void |
transform(java.lang.Object obj,
javax.xml.transform.Source transformationInstruction,
javax.xml.transform.Result result)
Deprecated. Use setPostprocessorInstruction(Source) and
serialize(Object, Result) . |
void |
writeXMLSchema(java.lang.Class type,
java.util.Collection componentTypes,
javax.xml.transform.Result result)
Write the XML schema definition of a type. |
void |
writeXMLSchema(java.lang.Class type,
javax.xml.transform.Result result)
Write the XML schema definition of a type. |
Method Detail |
---|
void serialize(java.lang.Object obj, javax.xml.transform.Result result) throws SerializerException
setPostprocessorInstruction(Source)
these are applied to the result of the serialization.
obj
- The object to serialize.result
- The result to serialize the Object to.
SerializerException
- If the serialization failed.java.lang.String serializeToString(java.lang.Object obj) throws SerializerException
setPostprocessorInstruction(Source)
these are applied to the result of the serialization.
obj
- The object to serialize.
SerializerException
- If the serialization failed.java.lang.Object deserialize(javax.xml.transform.Source src) throws DeserializerException
setPreprocessorInstruction(Source)
these are applied first to the Source before piping it into the
deserializer.
src
- Source of the object's XML representation.
DeserializerException
- If the deserialization failed.java.lang.Object deserializeFromString(java.lang.String s) throws DeserializerException
setPreprocessorInstruction(Source)
these are applied first to the source before piping it into the
deserializer.
s
- The string containing the object's XML representation.
DeserializerException
- If the deserialization failed.void writeXMLSchema(java.lang.Class type, javax.xml.transform.Result result) throws SerializerException
type
- The type of the object.result
- The result to write the schema to.
SerializerException
- If an error occured.void writeXMLSchema(java.lang.Class type, java.util.Collection componentTypes, javax.xml.transform.Result result) throws SerializerException
type
- The type of the object.componentTypes
- A collection of Class objects which contain the component types.result
- The result to write the schema to.
SerializerException
- If an error occured.java.lang.Object transform(java.lang.Object in, javax.xml.transform.Source instructionSrc) throws SerializerException, DeserializerException
setPostprocessorInstruction(Source)
and
transform(Object)
.
in
- The object to transform.instructionSrc
- The source where to get the XSLT instructions from.
SerializerException
- If an error occured in the serializer.
DeserializerException
- If an error occured in the deserializer.java.lang.Object transform(java.lang.Object in) throws SerializerException, DeserializerException
setPostprocessorInstruction(Source)
.
in
- The object to transform.
SerializerException
- If an error occured in the serializer.
DeserializerException
- If an error occured in the deserializer.void transform(java.lang.Object obj, javax.xml.transform.Source transformationInstruction, javax.xml.transform.Result result) throws SerializerException
setPostprocessorInstruction(Source)
and
serialize(Object, Result)
.
obj
- The object to transform.transformationInstruction
- A source of XSLT instructions or null if a simple copy
transformation has to be performed.result
- The result of the transformation.
SerializerException
- If an error occured.void setProperty(java.lang.String name, java.lang.Object value) throws NoImplementationException
name
- The name of the property to set.value
- The value of the property.
NoImplementationException
- If the name of the property is not valid.PropertyKeys
void setClassLoader(java.lang.ClassLoader classLoader)
classLoader
- The class loader to use.void setPreprocessorInstruction(javax.xml.transform.Source transformationInstruction) throws NoImplementationException
deserialize(Source)
or
deserializeFromString(String)
before deserializing the object.
transformationInstruction
- A source of XSLT instructions.
NoImplementationException
- If the transformer doesn't support this feature.void setPostprocessorInstruction(javax.xml.transform.Source transformationInstruction) throws NoImplementationException
serialize(Object, Result)
or serializeToString(Object)
after serializing the object.
Additionally, these instructions are used by transform(Object)
.
transformationInstruction
- A source of XSLT instructions.
NoImplementationException
- If the transformer doesn't support this feature.void serializeToJson(java.lang.Object obj, java.io.OutputStream stream) throws SerializerException
obj
- The object to serialize.stream
- The stream to write the JSON to. Note that JSON is always UTF-8
encoded.
SerializerException
- If the serialization failed.java.lang.String serializeToJsonString(java.lang.Object obj) throws SerializerException
obj
- The object to serialize.
SerializerException
- If the serialization failed.java.lang.Object deserializeFromJson(java.io.InputStream stream, java.lang.Class rootType) throws DeserializerException
stream
- The stream containing the JSON. Note that JSON is always UTF-8
encoded.rootType
- The type of the root object to instantiate. If null, then
LinkedList or HashMap is used depending on the JSON stream.
DeserializerException
- If the deserialization failed.java.lang.Object deserializeFromJson(java.io.InputStream stream) throws DeserializerException
stream
- The stream containing the JSON. Note that JSON is always UTF-8
encoded.
DeserializerException
- If the deserialization failed.java.lang.Object deserializeFromJsonString(java.lang.String s, java.lang.Class rootType) throws DeserializerException
s
- The String in JSON format.rootType
- The type of the root object to instantiate. If null, then
LinkedList or HashMap is used depending on the JSON string.
DeserializerException
- If the deserialization failed.java.lang.Object deserializeFromJsonString(java.lang.String s) throws DeserializerException
s
- The String in JSON format.
DeserializerException
- If the deserialization failed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |