public class XmlBeanTranslator extends Object implements BeanTranslator
| Constructor and Description |
|---|
XmlBeanTranslator()
Creates a new XML translator
By default the output will not be formated |
XmlBeanTranslator(boolean formattedOutput)
Creates a new XML translator
|
XmlBeanTranslator(boolean formattedOutput,
String rootTag)
Creates a new XML translator
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(Writer output) |
void |
closeArray(Writer output,
Object[] array,
String name,
Object parent) |
void |
closeCollection(Writer output,
Collection<?> collection,
String name,
Object parent) |
void |
closeObject(Writer output,
Object bean,
String name,
int subObjectsCount) |
void |
closeSubObjects(Writer output,
Object bean,
String name) |
void |
open(Writer output) |
void |
openArray(Writer output,
Object[] array,
String name,
Object parent) |
void |
openCollection(Writer output,
Collection<?> collection,
String name,
Object parent) |
void |
openObject(Writer output,
Object bean,
String name) |
void |
openSubObjects(Writer output,
Object bean,
String name) |
void |
setNullTag(String nullTag)
Set the name of the tag used for null objects ( the default is "null" and the output is "
If the tag name is set to null then no null tag will be written |
void |
setWriteNullAttribute(boolean flag)
Define if this writer must generate void attribute values for null values or not
If true : an attribute like firstName="" will be generated if the firstName property is null If false : no attribute will be generated if the property is null The default value is true. |
void |
writeComment(Writer output,
String comment)
Write a comment
|
void |
writeNullValue(Writer output,
String name,
Object parent)
Write a null value
|
void |
writeSubElementValue(Writer output,
Object value,
String name,
Object parent)
Write a basic value as a "sub-element"
|
void |
writeValue(Writer output,
Object obj,
String name,
Object parent)
Write a basic value
|
public XmlBeanTranslator()
public XmlBeanTranslator(boolean formattedOutput)
formattedOutput - indicates if the output must be formated or notpublic XmlBeanTranslator(boolean formattedOutput,
String rootTag)
formattedOutput - indicates if the output must be formated or notrootTag - the name to be used as the XML root tagpublic void setNullTag(String nullTag)
nullTag - the name of the null tag ( ie "NullObject" for public void setWriteNullAttribute(boolean flag)
flag - public void open(Writer output)
open in interface BeanTranslatorpublic void close(Writer output)
close in interface BeanTranslatorpublic void openSubObjects(Writer output, Object bean, String name)
openSubObjects in interface BeanTranslatorpublic void closeSubObjects(Writer output, Object bean, String name)
closeSubObjects in interface BeanTranslatorpublic void openObject(Writer output, Object bean, String name)
openObject in interface BeanTranslatorpublic void closeObject(Writer output, Object bean, String name, int subObjectsCount)
closeObject in interface BeanTranslatorpublic void writeComment(Writer output, String comment)
BeanTranslatorwriteComment in interface BeanTranslatorpublic void writeNullValue(Writer output, String name, Object parent)
BeanTranslatorwriteNullValue in interface BeanTranslatorname - the name of the valueparent - the parent objectpublic void writeValue(Writer output, Object obj, String name, Object parent)
BeanTranslatorwriteValue in interface BeanTranslatorobj - the value to write ( String, Number, Boolean, etc )name - the name of the valueparent - the parent objectpublic void writeSubElementValue(Writer output, Object value, String name, Object parent)
BeanTranslatorwriteSubElementValue in interface BeanTranslatorvalue - the value to write ( String, Number, Boolean, etc )name - the name of the valueparent - the parent objectpublic void openArray(Writer output, Object[] array, String name, Object parent)
openArray in interface BeanTranslatorpublic void closeArray(Writer output, Object[] array, String name, Object parent)
closeArray in interface BeanTranslatorpublic void openCollection(Writer output, Collection<?> collection, String name, Object parent)
openCollection in interface BeanTranslatorpublic void closeCollection(Writer output, Collection<?> collection, String name, Object parent)
closeCollection in interface BeanTranslatorCopyright © 2016. All rights reserved.