Package de.hybris.bootstrap.xml
Class DateTagWriter
- java.lang.Object
-
- de.hybris.bootstrap.xml.XMLTagWriter
-
- de.hybris.bootstrap.xml.SimpleTagWriter
-
- de.hybris.bootstrap.xml.DateTagWriter
-
public class DateTagWriter extends SimpleTagWriter
XML tag writer for outputtingDateobjects. Additionally it allows to define the date format pattern.
-
-
Constructor Summary
Constructors Constructor Description DateTagWriter(XMLTagWriter parent, java.lang.String tagName)Creates a new optional date tag writer.DateTagWriter(XMLTagWriter parent, java.lang.String tagName, boolean mandatory)Creates a new date tag writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.text.DateFormatcreateDateFormat()Creates the date format for this tag once.protected java.text.DateFormatgetDateFormat()voidsetDateFormat(java.lang.String pattern)Allows to define the date format by passing aSimpleDateFormatpattern to this tag.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
-
DateTagWriter
public DateTagWriter(XMLTagWriter parent, java.lang.String tagName)
Creates a new optional date tag writer.- Parameters:
parent- the parent tag writertagName- the tag name
-
DateTagWriter
public DateTagWriter(XMLTagWriter parent, java.lang.String tagName, boolean mandatory)
Creates a new date tag writer.- Parameters:
parent- the parent tag writertagName- the tag namemandatory- tells whether or not the tag writer requires a non-null value
-
-
Method Detail
-
setDateFormat
public void setDateFormat(java.lang.String pattern) throws java.lang.IllegalStateExceptionAllows to define the date format by passing aSimpleDateFormatpattern to this tag.Be sure to call this before writing any object!
- Parameters:
pattern- the pattern to use as date format- Throws:
java.lang.IllegalStateException- when the tag writer has already begun to write any object
-
createDateFormat
protected java.text.DateFormat createDateFormat()
Creates the date format for this tag once.
-
getDateFormat
protected final java.text.DateFormat getDateFormat()
-
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
-
-