|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.skaringa.javaxml.serializers.AbstractSerializer
public abstract class AbstractSerializer
Abstract class that provides methods common for all serializers.
Field Summary | |
---|---|
protected static java.lang.reflect.Field[] |
FIELD_TEMPLATE
This is used down in getFieldsToSerialize as a template for toArray(). |
Constructor Summary | |
---|---|
AbstractSerializer()
|
Method Summary | |
---|---|
static java.lang.reflect.Field |
getField(java.lang.Object obj,
java.lang.String fieldName)
Get a field of an object. |
static java.lang.reflect.Field[] |
getFieldsToSerialize(java.lang.Class type,
java.util.Comparator fieldComparator)
Get all fields to serialize for a type. |
static java.lang.Class |
getFieldType(java.lang.Object obj,
java.lang.String fieldName)
Get the type of a field of an object. |
protected void |
printEncodedStr(java.lang.String text,
java.io.PrintStream output)
|
protected void |
startElement(java.lang.Object obj,
java.lang.String type,
java.lang.String name,
java.util.Map propertyMap,
DocumentOutputHandlerInterface output)
Write an element start tag to the output. |
protected static java.lang.String |
subst(java.lang.String target,
java.lang.String oldString,
java.lang.String newString)
Substitute all occurences of oldString in target by newString. |
protected void |
writeXMLCollectionDef(java.lang.String componentElementName,
java.lang.Class componentElementType,
DocumentOutputHandlerInterface output)
Write the XML schema definition for a collection. |
protected void |
writeXMLExtensionDef(DocumentOutputHandlerInterface output,
java.lang.String baseType)
Write the XML schema definition for a type that only extends a base type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.skaringa.javaxml.serializers.ComponentSerializer |
---|
addUsedClasses, endDeserialize, getXMLTypeName, serialize, setMember, startDeserialize, toJson, writeXMLTypeDefinition |
Field Detail |
---|
protected static final java.lang.reflect.Field[] FIELD_TEMPLATE
Constructor Detail |
---|
public AbstractSerializer()
Method Detail |
---|
protected final void startElement(java.lang.Object obj, java.lang.String type, java.lang.String name, java.util.Map propertyMap, DocumentOutputHandlerInterface output) throws SerializerException
obj
- The object to write.type
- The type of the object.name
- The name of the object.propertyMap
- The output properties.output
- The handler used to write the output.
SerializerException
- If the element can't be written.public static java.lang.Class getFieldType(java.lang.Object obj, java.lang.String fieldName)
obj
- The object.fieldName
- Then field name.
public static java.lang.reflect.Field getField(java.lang.Object obj, java.lang.String fieldName) throws java.lang.NoSuchFieldException
obj
- The object.fieldName
- Then field name.
java.lang.NoSuchFieldException
- If the object doesn't have a field
with the specified name.public static java.lang.reflect.Field[] getFieldsToSerialize(java.lang.Class type, java.util.Comparator fieldComparator)
type
- The type.fieldComparator
- The comparator used to order the fields.
protected final void writeXMLCollectionDef(java.lang.String componentElementName, java.lang.Class componentElementType, DocumentOutputHandlerInterface output) throws SerializerException
componentElementName
- The name of the elements of the collection.componentElementType
- The type of the elements of the collection.output
- The handler used to write the output.
SerializerException
- If the definition can't be written.protected final void writeXMLExtensionDef(DocumentOutputHandlerInterface output, java.lang.String baseType) throws SerializerException
output
- The handler used to write the output.baseType
- The XML type name of the base type.
SerializerException
- If the definition can't be written.protected void printEncodedStr(java.lang.String text, java.io.PrintStream output)
protected static java.lang.String subst(java.lang.String target, java.lang.String oldString, java.lang.String newString)
target
- The target of the substitution.oldString
- The old string to be replaced.newString
- The new string.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |