|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
org.ggf.drmaa.PartialTimestampFormat
public class PartialTimestampFormat
This class coverts a PartialTimestamp to and from the DRMAA specified time
string. In order to represent a PartialTimestamp object as a string, the
PartialTimestamp object cannot have an unset field that is less significant
than the most significant set field. That is to say that if
CENTURY
is set, YEAR
, MONTH
, and
DAY_OF_MONTH
must also be set. SECONDS
and
ZONE_OFFSET
are always optional.
Example:
PartialTimestamp date = new PartialTimestamp(); PartialTimestampFormat ptf = new PartialTimestampFormat(); date.set(PartialTimestamp.HOUR_OF_DAY, 11); date.set(PartialTimestamp.MINUTE, 30); String timeString = ptf.format(date); PartialTimestamp date2 = ptf.parse(timeString); assert(date.equals(date2));
PartialTimestamp
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.Format |
---|
java.text.Format.Field |
Constructor Summary | |
---|---|
PartialTimestampFormat()
Creates a new instance of PartialTimestampFormat |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates a copy of this object. |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer stringBuffer,
java.text.FieldPosition fieldPosition)
Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. |
java.lang.String |
format(PartialTimestamp obj)
Translates the PartialTimestamp into a DRMAA specified time string. |
java.lang.StringBuffer |
format(PartialTimestamp obj,
java.lang.StringBuffer stringBuffer,
java.text.FieldPosition fieldPosition)
Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. |
PartialTimestamp |
parse(java.lang.String str)
Translates a DRMAA specified time string into a PartialTimestamp object. |
PartialTimestamp |
parse(java.lang.String str,
java.text.ParsePosition parsePosition)
Translates a DRMAA specified time string into a PartialTimestamp object. |
java.lang.Object |
parseObject(java.lang.String str,
java.text.ParsePosition parsePosition)
Translates a DRMAA specified time string into a PartialTimestamp object. |
Methods inherited from class java.text.Format |
---|
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PartialTimestampFormat()
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.text.Format
public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer stringBuffer, java.text.FieldPosition fieldPosition)
stringBuffer.append (format (obj))
.
In order to represent a PartialTimestamp object as a string, the
PartialTimestamp object cannot have an unset field that is less
significant than the most significant set field. TThat is to say that if
CENTURY
is set, YEAR
, MONTH
, and
DAY_OF_MONTH
must also be set. SECONDS
and
ZONE_OFFSET
are always optional.
format
in class java.text.Format
obj
- the object to formatstringBuffer
- the StringBuffer to which to append the resultsfieldPosition
- ignored
public java.lang.StringBuffer format(PartialTimestamp obj, java.lang.StringBuffer stringBuffer, java.text.FieldPosition fieldPosition)
stringBuffer.append (format (obj))
.
In order to represent a PartialTimestamp object as a string, the
PartialTimestamp object cannot have an unset field that is less
significant than the most significant set field. TThat is to say that if
CENTURY
is set, YEAR
, MONTH
, and
DAY_OF_MONTH
must also be set. SECONDS
and
ZONE_OFFSET
are always optional.
obj
- the object to formatstringBuffer
- the StringBuffer to which to append the resultsfieldPosition
- ignored
public java.lang.String format(PartialTimestamp obj)
format(obj, new StringBuffer (), new
FieldPosition(0)).toString()
.
In order to represent a PartialTimestamp object as a string, the
PartialTimestamp object cannot have an unset field that is less
significant than the most significant set field. TThat is to say that if
CENTURY
is set, YEAR
, MONTH
, and
DAY_OF_MONTH
must also be set. SECONDS
and
ZONE_OFFSET
are always optional.
obj
- the object to format
public PartialTimestamp parse(java.lang.String str) throws java.text.ParseException
HOUR_OF_DAY
and MINUTE
fields, if it
encounters unparsable text, it will stop and will not throw a
java.text.ParseException.
str
- a DRMAA specified time string
java.text.ParseException
- thrown if the string is not parsable.public PartialTimestamp parse(java.lang.String str, java.text.ParsePosition parsePosition)
str
- a DRMAA specified time stringparsePosition
- the parse position object
public java.lang.Object parseObject(java.lang.String str, java.text.ParsePosition parsePosition)
parseObject
in class java.text.Format
str
- a DRMAA specified time stringparsePosition
- the parse position object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |