java.lang.Object | |
↳ | org.joda.time.format.DateTimeParserBucket |
DateTimeParserBucket is an advanced class, intended mainly for parser implementations. It can also be used during normal parsing operations to capture more information about the parse.
This class allows fields to be saved in any order, but be physically set in a consistent order. This is useful for parsing against formats that allow field values to contradict each other.
Field values are applied in an order where the "larger" fields are set first, making their value less likely to stick. A field is larger than another when it's range duration is longer. If both ranges are the same, then the larger field has the longer duration. If it cannot be determined which field is larger, then the fields are set in the order they were saved.
For example, these fields were saved in this order: dayOfWeek, monthOfYear, dayOfMonth, dayOfYear. When computeMillis is called, the fields are set in this order: monthOfYear, dayOfYear, dayOfMonth, dayOfWeek.
DateTimeParserBucket is mutable and not thread-safe.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constucts a bucket.
| |||||||||||
Constucts a bucket, with the option of specifying the pivot year for
two-digit year parsing.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Computes the parsed datetime by setting the saved fields.
| |||||||||||
Computes the parsed datetime by setting the saved fields.
| |||||||||||
Computes the parsed datetime by setting the saved fields.
| |||||||||||
Gets the chronology of the bucket, which will be a local (UTC) chronology.
| |||||||||||
Returns the locale to be used during parsing.
| |||||||||||
Returns the time zone offset in milliseconds used by computeMillis,
unless getZone doesn't return null.
| |||||||||||
Returns the pivot year used for parsing two-digit years.
| |||||||||||
Returns the time zone used by computeMillis, or null if an offset is
used instead.
| |||||||||||
Restores the state of this bucket from a previously saved state.
| |||||||||||
Saves a datetime field value.
| |||||||||||
Saves a datetime field text value.
| |||||||||||
Saves a datetime field value.
| |||||||||||
Saves the state of this bucket, returning it in an opaque object.
| |||||||||||
Set a time zone offset to be used when computeMillis is called, which
overrides the time zone.
| |||||||||||
Sets the pivot year to use when parsing two digit years.
| |||||||||||
Set a time zone to be used when computeMillis is called, which
overrides any set time zone offset.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constucts a bucket.
instantLocal | the initial millis from 1970-01-01T00:00:00, local time |
---|---|
chrono | the chronology to use |
locale | the locale to use |
Constucts a bucket, with the option of specifying the pivot year for two-digit year parsing.
instantLocal | the initial millis from 1970-01-01T00:00:00, local time |
---|---|
chrono | the chronology to use |
locale | the locale to use |
pivotYear | the pivot year to use when parsing two-digit years |
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe.
resetFields | false by default, but when true, unsaved field values are cleared |
---|
IllegalArgumentException | if any field is out of range |
---|
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe.
resetFields | false by default, but when true, unsaved field values are cleared |
---|---|
text | optional text being parsed, to be included in any error message |
IllegalArgumentException | if any field is out of range |
---|
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe.
IllegalArgumentException | if any field is out of range |
---|
Gets the chronology of the bucket, which will be a local (UTC) chronology.
Returns the time zone offset in milliseconds used by computeMillis, unless getZone doesn't return null.
Returns the pivot year used for parsing two-digit years.
If null is returned, this indicates default behaviour
Returns the time zone used by computeMillis, or null if an offset is used instead.
Restores the state of this bucket from a previously saved state. The state object passed into this method is not consumed, and it can be used later to restore to that state again.
savedState | opaque saved state, returned from saveState |
---|
Saves a datetime field value.
field | the field, whose chronology must match that of this bucket |
---|---|
value | the value |
Saves a datetime field text value.
fieldType | the field type |
---|---|
text | the text value |
locale | the locale to use |
Saves a datetime field value.
fieldType | the field type |
---|---|
value | the value |
Saves the state of this bucket, returning it in an opaque object. Call restoreState to undo any changes that were made since the state was saved. Calls to saveState may be nested.
Set a time zone offset to be used when computeMillis is called, which overrides the time zone.
Sets the pivot year to use when parsing two digit years.
If the value is set to null, this will indicate that default behaviour should be used.
pivotYear | the pivot year to use |
---|
Set a time zone to be used when computeMillis is called, which overrides any set time zone offset.
zone | the date time zone to operate in, or null if UTC |
---|