Class PartialTimestampFormat
- All Implemented Interfaces:
Serializable
,Cloneable
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));
- Since:
- 0.5
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates a copy of this object.format
(Object obj, StringBuffer stringBuffer, FieldPosition fieldPosition) Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer.format
(PartialTimestamp obj) Translates the PartialTimestamp into a DRMAA specified time string.format
(PartialTimestamp obj, StringBuffer stringBuffer, FieldPosition fieldPosition) Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer.Translates a DRMAA specified time string into a PartialTimestamp object.parse
(String str, ParsePosition parsePosition) Translates a DRMAA specified time string into a PartialTimestamp object.parseObject
(String str, ParsePosition parsePosition) Translates a DRMAA specified time string into a PartialTimestamp object.Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Constructor Details
-
PartialTimestampFormat
public PartialTimestampFormat()Creates a new instance of PartialTimestampFormat
-
-
Method Details
-
clone
Creates a copy of this object. -
format
Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. Since the PartialTimestampFormat class doesn't use fields, the fieldPosition parameter is ignored. This method is equivalent tostringBuffer.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
, andDAY_OF_MONTH
must also be set.SECONDS
andZONE_OFFSET
are always optional. -
format
public StringBuffer format(PartialTimestamp obj, StringBuffer stringBuffer, FieldPosition fieldPosition) Translates the PartialTimestamp into a DRMAA specified time string and appends the string to the given StringBuffer. Since the PartialTimestampFormat class doesn't use fields, the fieldPosition parameter is ignored. This method is equivalent tostringBuffer.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
, andDAY_OF_MONTH
must also be set.SECONDS
andZONE_OFFSET
are always optional.- Parameters:
obj
- the object to formatstringBuffer
- the StringBuffer to which to append the resultsfieldPosition
- ignored- Returns:
- the stringBuffer parameter
-
format
Translates the PartialTimestamp into a DRMAA specified time string. This method is equivalent toformat(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
, andDAY_OF_MONTH
must also be set.SECONDS
andZONE_OFFSET
are always optional.- Parameters:
obj
- the object to format- Returns:
- the DRMAA specified time string
-
parse
Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible, but after successfully parsing theHOUR_OF_DAY
andMINUTE
fields, if it encounters unparsable text, it will stop and will not throw a java.text.ParseException.- Parameters:
str
- a DRMAA specified time string- Returns:
- a PartialTimestamp object
- Throws:
ParseException
- thrown if the string is not parsable.
-
parse
Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible. Upon completion, the parse position object will contain the index of the last character parsed.- Parameters:
str
- a DRMAA specified time stringparsePosition
- the parse position object- Returns:
- a PartialTimestamp object
-
parseObject
Translates a DRMAA specified time string into a PartialTimestamp object. This method will parse as far as possible. Upon completion, the parse position object will contain the index of the last character parsed.- Specified by:
parseObject
in classFormat
- Parameters:
str
- a DRMAA specified time stringparsePosition
- the parse position object- Returns:
- a PartialTimestamp object
-