public class NumberTagWriter extends SimpleTagWriter
Number objects. Optionally it allows to pass a own number format string.| Constructor and Description |
|---|
NumberTagWriter(XMLTagWriter parent,
String tagName)
Creates a new optional number tag writer.
|
NumberTagWriter(XMLTagWriter parent,
String tagName,
boolean mandatory)
Creates a new number tag writer.
|
| Modifier and Type | Method and Description |
|---|---|
protected NumberFormat |
createNumberFormat()
Creates this tag's number format once.
|
protected NumberFormat |
getNumberFormat() |
void |
setFormat(String pattern)
Configures this tag writer by setting a
DecimalFormat format pattern string. |
protected void |
writeContent(XMLOutputter xmlOut,
Object object)
Outputs the given objects by calling its
Object.toString() method. |
getTagNameaddSubTagWriter, addSubTagWriter, addSubTagWriter, debug, error, getAllSubTagWriter, getAttributesMap, getEnclosingWriter, getParent, getSubTagWriter, getSubTagWriter, getSubTagWriterMap, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isMandatory, isWarnEnabled, warn, writepublic NumberTagWriter(XMLTagWriter parent, String tagName)
parent - the parent tag writertagName - the tag namepublic NumberTagWriter(XMLTagWriter parent, String tagName, boolean mandatory)
parent - the parent tag writertagName - the tag namemandatory - tells whether or not the tag requires a non-null valuepublic void setFormat(String pattern) throws IllegalStateException
DecimalFormat format pattern string.
Be sure to call this prior to writing any object.
pattern - the decimal format patternIllegalStateException - if the tag has already begun to write any objectprotected NumberFormat createNumberFormat()
setFormat(String) to define a own format. Otherwise this
method will return the format specified by NumberFormat.getNumberInstance().protected final NumberFormat getNumberFormat()
protected void writeContent(XMLOutputter xmlOut,
Object object)
throws IOException
SimpleTagWriterObject.toString() method.writeContent in class SimpleTagWriterxmlOut - the XMLOutputter to write toobject - the data object provided by the parent tag writer, may be nullIOExceptionCopyright © 2017 SAP SE. All Rights Reserved.