|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.text.Format
|
+--org.joda.time.TimePeriodFormat
TimePeriodFormat provides formatting and parsing capabilities to the TimePeriod class. The parse method with return TimePeriod Objects.
The ISO Time Period specification defines several formats for a time period. These are defined as constants in this class. There is a limted set of valid format defined in the specification, for this reason the constructor of this class is private and users must use one of the predefined format constants to format and parse strings.
A Time Period is formatted according to the data that was used to create it. These can be off the forms:
DateTimeFormat.
Standard Basic takes the form: PnYnMnDTnHnMnS where n is the value of the following component designator.
Standard Extended takes the same form except when a date component exists the date is formated in the EXTENDED DateTime form as opposed to the BASIC form.
There are variations in the above two formats to either, allow components that are zero to be ommited, force components that are 0 to be included or represent the period using weeks only, i.e. PnW
Alternative Basic takes the form: PYYYYMMDDThhmmss.
Alternative Extended takes the form: PYYYY-MM-DDThh:mm:ss and uses the EXTENDED DateTime format for format date components.
The two alternative formats have the variations to allow or deny truncating of components equalling zero.
| Field Summary | |
static TimePeriodFormat |
ISO_ALTERNATIVE_BASIC_NO_TRUNCATE_FORMAT
Formatter for the ISO Alternative Basic Time Period format that does not truncate zero components. |
static TimePeriodFormat |
ISO_ALTERNATIVE_BASIC_TRUNCATE_FORMAT
Formatter for the ISO Alternative Basic Time Period format that truncates zero components. |
static TimePeriodFormat |
ISO_ALTERNATIVE_EXTENDED_NO_TRUNCATE_FORMAT
Formatter for the ISO Alternative Extended Time Period format that does not truncate zero components. |
static TimePeriodFormat |
ISO_ALTERNATIVE_EXTENDED_TRUNCATE_FORMAT
Formatter for the ISO Alternative Extended Time Period format that truncates zero components. |
static TimePeriodFormat |
ISO_STANDARD_BASIC_FORMAT
Formatter for the ISO Standard Basic Time Period format that does not ommit components that are equal to zero. |
static TimePeriodFormat |
ISO_STANDARD_BASIC_WEEKS_ONLY_FORMAT
Formatter for the ISO Standard Basic Time Period format that formats using weeks only. |
static TimePeriodFormat |
ISO_STANDARD_BASIC_ZERO_OMIT_FORMAT
Formatter for the ISO Standard Basic Time Period format that ommits components that are equal to zero. |
static TimePeriodFormat |
ISO_STANDARD_EXTENDED_FORMAT
Formatter for the ISO Standard Extended Time Period format that ommits components that are equal to zero. |
static TimePeriodFormat |
ISO_STANDARD_EXTENDED_WEEKS_ONLY_FORMAT
Formatter for the ISO Standard Extended Time Period format that formats using weeks only. |
static TimePeriodFormat |
ISO_STANDARD_EXTENDED_ZERO_OMIT_FORMAT
Formatter for the ISO Standard Extended Time Period format that ommits components that are equal to zero. |
| Method Summary | |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer buffer,
java.text.FieldPosition pos)
Formats obj in accordance with this formatter type. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition status)
Parses the specified string to a TimePeriod Object. |
| Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final TimePeriodFormat ISO_STANDARD_BASIC_ZERO_OMIT_FORMAT
public static final TimePeriodFormat ISO_STANDARD_EXTENDED_ZERO_OMIT_FORMAT
public static final TimePeriodFormat ISO_STANDARD_BASIC_FORMAT
public static final TimePeriodFormat ISO_STANDARD_EXTENDED_FORMAT
public static final TimePeriodFormat ISO_STANDARD_BASIC_WEEKS_ONLY_FORMAT
public static final TimePeriodFormat ISO_STANDARD_EXTENDED_WEEKS_ONLY_FORMAT
public static final TimePeriodFormat ISO_ALTERNATIVE_BASIC_TRUNCATE_FORMAT
public static final TimePeriodFormat ISO_ALTERNATIVE_EXTENDED_TRUNCATE_FORMAT
public static final TimePeriodFormat ISO_ALTERNATIVE_BASIC_NO_TRUNCATE_FORMAT
public static final TimePeriodFormat ISO_ALTERNATIVE_EXTENDED_NO_TRUNCATE_FORMAT
| Method Detail |
public java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer buffer,
java.text.FieldPosition pos)
format in class java.text.Formatobj - the object to formatbuffer - the StringBuffer to append the output topos - the position to start at
java.lang.IllegalArgumentException - if this formatter doesnt handle
the type of the Object obj.Format.format(Object,StringBuffer,FieldPosition)
public java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition status)
parseObject in class java.text.Formatsource - the string to parse to a TimePeriodstatus - object that hold index and error index information
Format.parseObject(String,ParsePosition)
|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||