public class PartialTimestampFormat
extends java.text.Format
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 Form| Constructor and Description |
|---|
PartialTimestampFormat()
Creates a new instance of PartialTimestampFormat
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public PartialTimestampFormat()
public java.lang.Object clone()
clone in class java.text.Formatpublic 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.Formatobj - the object to formatstringBuffer - the StringBuffer to which to append the resultsfieldPosition - ignoredpublic 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 - ignoredpublic 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 formatpublic 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 stringjava.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 objectpublic java.lang.Object parseObject(java.lang.String str,
java.text.ParsePosition parsePosition)
parseObject in class java.text.Formatstr - a DRMAA specified time stringparsePosition - the parse position object
The contents of this file are licensed under the Sun Industry Standards Source License version 1.2.
Copyright 2008, Sun Microsystems, Inc.