|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ujac.util.xml.BaseObjectSerializer org.ujac.util.xml.DynamicObjectSerializer
public class DynamicObjectSerializer
Name: DynamicObjectSerializer
Description: A dynamic configurable object serializer.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.ujac.util.xml.BaseObjectSerializer |
---|
BaseObjectSerializer.ObjectHandler, BaseObjectSerializer.StackElement |
Field Summary |
---|
Fields inherited from class org.ujac.util.xml.BaseObjectSerializer |
---|
parentSerializer |
Constructor Summary | |
---|---|
DynamicObjectSerializer()
Constructs a DynamicObjectSerializer instance with no specific attributes. |
|
DynamicObjectSerializer(String encoding)
Constructs a DynamicObjectSerializer instance with specific attributes. |
|
DynamicObjectSerializer(String encoding,
TypeConverter typeConverter)
Constructs a DynamicObjectSerializer instance with specific attributes. |
Method Summary | |
---|---|
String |
attributeName2PropertyName(String attributeName)
Converts the given attribute name (form: parta-partb) into a property name (form: partaPartb). |
void |
endElement(BaseObjectSerializer.StackElement localElement,
String content,
BaseObjectSerializer.StackElement parentElement,
Object root)
Ends the given local element. |
ComplexTypeDefinition |
getComplexType(Class clazz)
Gets the element class for the given tag name. |
ComplexTypeDefinition |
getComplexType(String name)
Gets the element class for the given tag name. |
ElementDefinition |
getRootElement()
Gets the root element definition. |
String |
propertyName2AttributeName(String propertyName)
Converts the given property name (form: partaPartb) into a attribute name (form: parta-partb). |
protected void |
registerComplexTypes()
Registers the base complex types. |
void |
setComplexType(ComplexTypeDefinition clazz)
Sets the element class for the given tag name. |
void |
setRootElement(ElementDefinition rootElement)
Sets the root element definition. |
void |
startElement(BaseObjectSerializer.StackElement localElement,
BaseObjectSerializer.StackElement parentElement,
Object root)
Starts the given local element. |
void |
write(PrintWriter writer,
Object obj)
Writes an object to the given print writer. |
void |
writeObject(PrintWriter writer,
ElementDefinition elementDefinition,
Object obj,
int level)
Writes an object to the given print writer. |
Methods inherited from class org.ujac.util.xml.BaseObjectSerializer |
---|
closeOpenTag, delegateHandler, getEncoding, getRootLevel, getRootObject, indent, parseBooleanValue, parseIntValue, read, read, read, setEncoding, setRootLevel, startNewLine, write, write, writeAttribute, writeAttribute, writeAttribute, writeCloseTag, writeOpenTag, writeTag, writeTagBody |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DynamicObjectSerializer()
public DynamicObjectSerializer(String encoding)
encoding
- The encoding to use.public DynamicObjectSerializer(String encoding, TypeConverter typeConverter)
encoding
- The encoding to use.typeConverter
- The type converter to use.Method Detail |
---|
public ElementDefinition getRootElement()
public void setRootElement(ElementDefinition rootElement)
rootElement
- The root element definition.protected void registerComplexTypes()
public void setComplexType(ComplexTypeDefinition clazz)
clazz
- The element class to define.public ComplexTypeDefinition getComplexType(String name)
name
- The tag name to retrieve the element class for.
public ComplexTypeDefinition getComplexType(Class clazz)
clazz
- The object class to retrieve the type definition for.
public void write(PrintWriter writer, Object obj) throws IOException
write
in class BaseObjectSerializer
writer
- The writer to write the WebForm to.obj
- The instance to write.
IOException
- In case an I/O failure occurred.public void writeObject(PrintWriter writer, ElementDefinition elementDefinition, Object obj, int level) throws IOException
writer
- The writer to write the WebForm to.elementDefinition
- The definition of the element.obj
- The instance to write.level
- The indention level.
IOException
- In case an I/O failure occurred.public void startElement(BaseObjectSerializer.StackElement localElement, BaseObjectSerializer.StackElement parentElement, Object root) throws SAXException
BaseObjectSerializer
startElement
in class BaseObjectSerializer
localElement
- The element to process.parentElement
- The parent element if present, else null.root
- The root object of the data structure.
SAXException
- In case the parsing failed.BaseObjectSerializer.startElement(org.ujac.util.xml.BaseObjectSerializer.StackElement, org.ujac.util.xml.BaseObjectSerializer.StackElement, java.lang.Object)
public void endElement(BaseObjectSerializer.StackElement localElement, String content, BaseObjectSerializer.StackElement parentElement, Object root) throws SAXException
BaseObjectSerializer
endElement
in class BaseObjectSerializer
localElement
- The element to process.content
- The content of the local element.parentElement
- The parent element if present, else null.root
- The root object of the data structure.
SAXException
- In case the parsing failed.BaseObjectSerializer.endElement(org.ujac.util.xml.BaseObjectSerializer.StackElement, java.lang.String, org.ujac.util.xml.BaseObjectSerializer.StackElement, java.lang.Object)
public String attributeName2PropertyName(String attributeName)
attributeName
- The attribute name to convert.
public String propertyName2AttributeName(String propertyName)
propertyName
- The property name to convert.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |