Package de.hybris.bootstrap.xml
Class NumberTagWriter
java.lang.Object
de.hybris.bootstrap.xml.XMLTagWriter
de.hybris.bootstrap.xml.SimpleTagWriter
de.hybris.bootstrap.xml.NumberTagWriter
Basic tag writer for
Number objects. Optionally it allows to pass a own number format string.-
Constructor Summary
ConstructorsConstructorDescriptionNumberTagWriter(XMLTagWriter parent, String tagName) Creates a new optional number tag writer.NumberTagWriter(XMLTagWriter parent, String tagName, boolean mandatory) Creates a new number tag writer. -
Method Summary
Modifier and TypeMethodDescriptionprotected NumberFormatCreates this tag's number format once.protected final NumberFormatvoidConfigures this tag writer by setting aDecimalFormatformat pattern string.protected voidwriteContent(org.znerd.xmlenc.XMLOutputter xmlOut, Object object) Outputs the given objects by calling itsObject.toString()method.Methods inherited from class de.hybris.bootstrap.xml.SimpleTagWriter
getTagNameMethods inherited from class de.hybris.bootstrap.xml.XMLTagWriter
addSubTagWriter, addSubTagWriter, addSubTagWriter, debug, error, getAllSubTagWriter, getAttributesMap, getEnclosingWriter, getParent, getSubTagWriter, getSubTagWriter, getSubTagWriterMap, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isMandatory, isWarnEnabled, warn, write
-
Constructor Details
-
NumberTagWriter
Creates a new optional number tag writer.- Parameters:
parent- the parent tag writertagName- the tag name
-
NumberTagWriter
Creates a new number tag writer.- Parameters:
parent- the parent tag writertagName- the tag namemandatory- tells whether or not the tag requires a non-null value
-
-
Method Details
-
setFormat
Configures this tag writer by setting aDecimalFormatformat pattern string.Be sure to call this prior to writing any object.
- Parameters:
pattern- the decimal format pattern- Throws:
IllegalStateException- if the tag has already begun to write any object
-
createNumberFormat
Creates this tag's number format once. UsesetFormat(String)to define a own format. Otherwise this method will return the format specified byNumberFormat.getNumberInstance(). -
getNumberFormat
-
writeContent
Description copied from class:SimpleTagWriterOutputs the given objects by calling itsObject.toString()method.- Overrides:
writeContentin classSimpleTagWriter- Parameters:
xmlOut- theXMLOutputterto write toobject- the data object provided by the parent tag writer, may be null- Throws:
IOException
-