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
-
public class NumberTagWriter extends SimpleTagWriter
Basic tag writer forNumberobjects. Optionally it allows to pass a own number format string.
-
-
Constructor Summary
Constructors Constructor Description NumberTagWriter(XMLTagWriter parent, java.lang.String tagName)Creates a new optional number tag writer.NumberTagWriter(XMLTagWriter parent, java.lang.String tagName, boolean mandatory)Creates a new number tag writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.text.NumberFormatcreateNumberFormat()Creates this tag's number format once.protected java.text.NumberFormatgetNumberFormat()voidsetFormat(java.lang.String pattern)Configures this tag writer by setting aDecimalFormatformat pattern string.protected voidwriteContent(org.znerd.xmlenc.XMLOutputter xmlOut, java.lang.Object object)Outputs the given objects by calling itsObject.toString()method.-
Methods inherited from class de.hybris.bootstrap.xml.SimpleTagWriter
getTagName
-
Methods 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 Detail
-
NumberTagWriter
public NumberTagWriter(XMLTagWriter parent, java.lang.String tagName)
Creates a new optional number tag writer.- Parameters:
parent- the parent tag writertagName- the tag name
-
NumberTagWriter
public NumberTagWriter(XMLTagWriter parent, java.lang.String tagName, boolean mandatory)
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 Detail
-
setFormat
public void setFormat(java.lang.String pattern) throws java.lang.IllegalStateExceptionConfigures 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:
java.lang.IllegalStateException- if the tag has already begun to write any object
-
createNumberFormat
protected java.text.NumberFormat 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
protected final java.text.NumberFormat getNumberFormat()
-
writeContent
protected void writeContent(org.znerd.xmlenc.XMLOutputter xmlOut, java.lang.Object object) throws java.io.IOExceptionDescription 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:
java.io.IOException
-
-