java.lang.Object | |
↳ | org.joda.time.base.AbstractPartial |
![]() |
![]() |
AbstractPartial provides a standard base implementation of most methods in the ReadablePartial interface.
Calculations on are performed using a Chronology
.
This chronology is set to be in the UTC time zone for all calculations.
The methods on this class use size()
,
getField(int, Chronology)
and
getValue(int)
to calculate their results.
Subclasses may have a better implementation.
AbstractPartial allows subclasses may be mutable and not thread-safe.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares this partial with another returning an integer
indicating the order.
| |||||||||||
Compares this ReadablePartial with another returning true if the chronology,
field types and values are equal.
| |||||||||||
Get the value of one of the fields of a datetime.
| |||||||||||
Gets the field at the specifed index.
| |||||||||||
Gets the field type at the specifed index.
| |||||||||||
Gets an array of the field types that this partial supports.
| |||||||||||
Gets an array of the fields that this partial supports.
| |||||||||||
Gets an array of the value of each of the fields that this partial supports.
| |||||||||||
Gets a hash code for the ReadablePartial that is compatible with the
equals method.
| |||||||||||
Gets the index of the specified field, or -1 if the field is unsupported.
| |||||||||||
Is this partial later than the specified partial.
| |||||||||||
Is this partial earlier than the specified partial.
| |||||||||||
Is this partial the same as the specified partial.
| |||||||||||
Checks whether the field specified is supported by this partial.
| |||||||||||
Resolves this partial against another complete instant to create a new
full instant.
| |||||||||||
Uses the specified formatter to convert this partial to a String.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the field for a specific index in the chronology specified.
| |||||||||||
Gets the index of the first fields to have the specified duration,
or -1 if the field is unsupported.
| |||||||||||
Gets the index of the first fields to have the specified duration,
throwing an exception if the field is unsupported.
| |||||||||||
Gets the index of the specified field, throwing an exception if the
field is unsupported.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructor.
Compares this partial with another returning an integer indicating the order.
The fields are compared in order, from largest to smallest. The first field that is non-equal is used to determine the result.
The specified object must be a partial instance whose field types match those of this partial.
NOTE: This implementation violates the Comparable contract. This method will accept any instance of ReadablePartial as input. However, it is possible that some implementations of ReadablePartial exist that do not extend AbstractPartial, and thus will throw a ClassCastException if compared in the opposite direction. The cause of this problem is that ReadablePartial doesn't define the compareTo() method, however we can't change that until v2.0.
partial | an object to check against |
---|
ClassCastException | if the partial is the wrong class or if it has field types that don't match |
---|---|
NullPointerException | if the partial is null |
Compares this ReadablePartial with another returning true if the chronology, field types and values are equal.
partial | an object to check against |
---|
Get the value of one of the fields of a datetime.
The field specified must be one of those that is supported by the partial.
type | a DateTimeFieldType instance that is supported by this partial |
---|
IllegalArgumentException | if the field is null or not supported |
---|
Gets the field at the specifed index.
index | the index |
---|
IndexOutOfBoundsException | if the index is invalid |
---|
Gets the field type at the specifed index.
index | the index |
---|
IndexOutOfBoundsException | if the index is invalid |
---|
Gets an array of the field types that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
Gets an array of the fields that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
Gets an array of the value of each of the fields that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
Each value corresponds to the same array index as getFields()
Gets a hash code for the ReadablePartial that is compatible with the equals method.
Gets the index of the specified field, or -1 if the field is unsupported.
type | the type to check, may be null which returns -1 |
---|
Is this partial later than the specified partial.
The fields are compared in order, from largest to smallest. The first field that is non-equal is used to determine the result.
You may not pass null into this method. This is because you need a time zone to accurately determine the current date.
partial | a partial to check against, must not be null |
---|
IllegalArgumentException | if the specified partial is null |
---|---|
ClassCastException | if the partial has field types that don't match |
Is this partial earlier than the specified partial.
The fields are compared in order, from largest to smallest. The first field that is non-equal is used to determine the result.
You may not pass null into this method. This is because you need a time zone to accurately determine the current date.
partial | a partial to check against, must not be null |
---|
IllegalArgumentException | if the specified partial is null |
---|---|
ClassCastException | if the partial has field types that don't match |
Is this partial the same as the specified partial.
The fields are compared in order, from largest to smallest. If all fields are equal, the result is true.
You may not pass null into this method. This is because you need a time zone to accurately determine the current date.
partial | a partial to check against, must not be null |
---|
IllegalArgumentException | if the specified partial is null |
---|---|
ClassCastException | if the partial has field types that don't match |
Checks whether the field specified is supported by this partial.
type | the type to check, may be null which returns false |
---|
Resolves this partial against another complete instant to create a new full instant. The combination is performed using the chronology of the specified instant.
For example, if this partial represents a time, then the result of this method will be the datetime from the specified base instant plus the time from this partial.
baseInstant | the instant that provides the missing fields, null means now |
---|
Uses the specified formatter to convert this partial to a String.
formatter | the formatter to use, null means use toString() . |
---|
Gets the field for a specific index in the chronology specified.
This method must not use any instance variables.
index | the index to retrieve |
---|---|
chrono | the chronology to use |
IndexOutOfBoundsException | if the index is invalid |
---|
Gets the index of the first fields to have the specified duration, or -1 if the field is unsupported.
type | the type to check, may be null which returns -1 |
---|
Gets the index of the first fields to have the specified duration, throwing an exception if the field is unsupported.
type | the type to check, not null |
---|
IllegalArgumentException | if the field is null or not supported |
---|
Gets the index of the specified field, throwing an exception if the field is unsupported.
type | the type to check, not null |
---|
IllegalArgumentException | if the field is null or not supported |
---|