public class DateTagWriter extends SimpleTagWriter
Date objects. Additionally it allows to define the date format
pattern.| Constructor and Description |
|---|
DateTagWriter(XMLTagWriter parent,
String tagName)
Creates a new optional date tag writer.
|
DateTagWriter(XMLTagWriter parent,
String tagName,
boolean mandatory)
Creates a new date tag writer.
|
| Modifier and Type | Method and Description |
|---|---|
protected DateFormat |
createDateFormat()
Creates the date format for this tag once.
|
protected DateFormat |
getDateFormat() |
void |
setDateFormat(String pattern)
Allows to define the date format by passing a
SimpleDateFormat pattern to this tag. |
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 DateTagWriter(XMLTagWriter parent, String tagName)
parent - the parent tag writertagName - the tag namepublic DateTagWriter(XMLTagWriter parent, String tagName, boolean mandatory)
parent - the parent tag writertagName - the tag namemandatory - tells whether or not the tag writer requires a non-null valuepublic void setDateFormat(String pattern) throws IllegalStateException
SimpleDateFormat pattern to this tag.
Be sure to call this before writing any object!
pattern - the pattern to use as date formatIllegalStateException - when the tag writer has already begun to write any objectprotected DateFormat createDateFormat()
protected final DateFormat getDateFormat()
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.