org.joda.time.field
Class DelegatedDateTimeField

java.lang.Object
  extended by org.joda.time.DateTimeField
      extended by org.joda.time.field.DelegatedDateTimeField
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LenientDateTimeField, SkipDateTimeField, SkipUndoDateTimeField, StrictDateTimeField

public class DelegatedDateTimeField
extends DateTimeField
implements Serializable

DelegatedDateTimeField delegates each method call to the date time field it wraps.

DelegatedDateTimeField is thread-safe and immutable, and its subclasses must be as well.

Since:
1.0
Author:
Brian S O'Neill
See Also:
DecoratedDateTimeField, Serialized Form

Constructor Summary
DelegatedDateTimeField(DateTimeField field)
          Constructor.
DelegatedDateTimeField(DateTimeField field, DateTimeFieldType type)
          Constructor.
 
Method Summary
 long add(long instant, int value)
          Adds a value (which may be negative) to the millis value, overflowing into larger fields if necessary.
 long add(long instant, long value)
          Adds a value (which may be negative) to the millis value, overflowing into larger fields if necessary.
 int[] add(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Adds a value (which may be negative) to the partial instant, throwing an exception if the maximum size of the instant is reached.
 long addWrapField(long instant, int value)
          Adds a value (which may be negative) to the millis value, wrapping within this field.
 int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Adds a value (which may be negative) to the partial instant, wrapping within this field.
 int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Adds a value (which may be negative) to the partial instant, wrapping the whole partial if the maximum size of the partial is reached.
 int get(long instant)
          Get the value of this field from the milliseconds.
 String getAsShortText(int fieldValue, Locale locale)
          Get the human-readable, short text value of this field from the field value.
 String getAsShortText(long instant)
          Get the human-readable, short text value of this field from the milliseconds.
 String getAsShortText(long instant, Locale locale)
          Get the human-readable, short text value of this field from the milliseconds.
 String getAsShortText(ReadablePartial partial, int fieldValue, Locale locale)
          Get the human-readable, short text value of this field from a partial instant.
 String getAsShortText(ReadablePartial partial, Locale locale)
          Get the human-readable, short text value of this field from a partial instant.
 String getAsText(int fieldValue, Locale locale)
          Get the human-readable, text value of this field from the field value.
 String getAsText(long instant)
          Get the human-readable, text value of this field from the milliseconds.
 String getAsText(long instant, Locale locale)
          Get the human-readable, text value of this field from the milliseconds.
 String getAsText(ReadablePartial partial, int fieldValue, Locale locale)
          Get the human-readable, text value of this field from a partial instant.
 String getAsText(ReadablePartial partial, Locale locale)
          Get the human-readable, text value of this field from a partial instant.
 int getDifference(long minuendInstant, long subtrahendInstant)
          Computes the difference between two instants, as measured in the units of this field.
 long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)
          Computes the difference between two instants, as measured in the units of this field.
 DurationField getDurationField()
          Returns the duration per unit value of this field.
 int getLeapAmount(long instant)
          Gets the amount by which this field is 'leap' for the specified instant.
 DurationField getLeapDurationField()
          If this field were to leap, then it would be in units described by the returned duration.
 int getMaximumShortTextLength(Locale locale)
          Get the maximum short text value for this field.
 int getMaximumTextLength(Locale locale)
          Get the maximum text value for this field.
 int getMaximumValue()
          Get the maximum allowable value for this field.
 int getMaximumValue(long instant)
          Get the maximum value for this field evaluated at the specified time.
 int getMaximumValue(ReadablePartial instant)
          Get the maximum value for this field evaluated at the specified time.
 int getMaximumValue(ReadablePartial instant, int[] values)
          Get the maximum value for this field using the partial instant and the specified values.
 int getMinimumValue()
          Get the minimum allowable value for this field.
 int getMinimumValue(long instant)
          Get the minimum value for this field evaluated at the specified time.
 int getMinimumValue(ReadablePartial instant)
          Get the minimum value for this field evaluated at the specified time.
 int getMinimumValue(ReadablePartial instant, int[] values)
          Get the minimum value for this field using the partial instant and the specified values.
 String getName()
          Get the name of the field.
 DurationField getRangeDurationField()
          Returns the range duration of this field.
 DateTimeFieldType getType()
          Get the type of the field.
 DateTimeField getWrappedField()
          Gets the wrapped date time field.
 boolean isLeap(long instant)
          Returns whether this field is 'leap' for the specified instant.
 boolean isLenient()
          Returns true if the set method is lenient.
 boolean isSupported()
          Returns true if this field is supported.
 long remainder(long instant)
          Returns the fractional duration milliseconds of this field.
 long roundCeiling(long instant)
          Round to the highest whole unit of this field.
 long roundFloor(long instant)
          Round to the lowest whole unit of this field.
 long roundHalfCeiling(long instant)
          Round to the nearest whole unit of this field.
 long roundHalfEven(long instant)
          Round to the nearest whole unit of this field.
 long roundHalfFloor(long instant)
          Round to the nearest whole unit of this field.
 long set(long instant, int value)
          Sets a value in the milliseconds supplied.
 long set(long instant, String text)
          Sets a value in the milliseconds supplied from a human-readable, text value.
 long set(long instant, String text, Locale locale)
          Sets a value in the milliseconds supplied from a human-readable, text value.
 int[] set(ReadablePartial instant, int fieldIndex, int[] values, int newValue)
          Sets a value using the specified partial instant.
 int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale)
          Sets a value in the milliseconds supplied from a human-readable, text value.
 String toString()
          Get a suitable debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegatedDateTimeField

public DelegatedDateTimeField(DateTimeField field)
Constructor.

Parameters:
field - the field being decorated

DelegatedDateTimeField

public DelegatedDateTimeField(DateTimeField field,
                              DateTimeFieldType type)
Constructor.

Parameters:
field - the field being decorated
type - the field type override
Method Detail

getWrappedField

public final DateTimeField getWrappedField()
Gets the wrapped date time field.

Returns:
the wrapped DateTimeField

getType

public DateTimeFieldType getType()
Description copied from class: DateTimeField
Get the type of the field.

Specified by:
getType in class DateTimeField
Returns:
field type

getName

public String getName()
Description copied from class: DateTimeField
Get the name of the field.

By convention, names follow a pattern of "dddOfRrr", where "ddd" represents the (singular) duration unit field name and "Rrr" represents the (singular) duration range field name. If the range field is not applicable, then the name of the field is simply the (singular) duration field name.

Specified by:
getName in class DateTimeField
Returns:
field name

isSupported

public boolean isSupported()
Description copied from class: DateTimeField
Returns true if this field is supported.

Specified by:
isSupported in class DateTimeField
Returns:
true if this field is supported

isLenient

public boolean isLenient()
Description copied from class: DateTimeField
Returns true if the set method is lenient. If so, it accepts values that are out of bounds. For example, a lenient day of month field accepts 32 for January, converting it to February 1.

Specified by:
isLenient in class DateTimeField
Returns:
true if this field is lenient

get

public int get(long instant)
Description copied from class: DateTimeField
Get the value of this field from the milliseconds.

Specified by:
get in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
Returns:
the value of the field, in the units of the field

getAsText

public String getAsText(long instant,
                        Locale locale)
Description copied from class: DateTimeField
Get the human-readable, text value of this field from the milliseconds. If the specified locale is null, the default locale is used.

Specified by:
getAsText in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsText

public String getAsText(long instant)
Description copied from class: DateTimeField
Get the human-readable, text value of this field from the milliseconds.

Specified by:
getAsText in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
Returns:
the text value of the field

getAsText

public String getAsText(ReadablePartial partial,
                        int fieldValue,
                        Locale locale)
Description copied from class: DateTimeField
Get the human-readable, text value of this field from a partial instant. If the specified locale is null, the default locale is used.

Specified by:
getAsText in class DateTimeField
Parameters:
partial - the partial instant to query
fieldValue - the field value of this field, provided for performance
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsText

public String getAsText(ReadablePartial partial,
                        Locale locale)
Description copied from class: DateTimeField
Get the human-readable, text value of this field from a partial instant. If the specified locale is null, the default locale is used.

Specified by:
getAsText in class DateTimeField
Parameters:
partial - the partial instant to query
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsText

public String getAsText(int fieldValue,
                        Locale locale)
Description copied from class: DateTimeField
Get the human-readable, text value of this field from the field value. If the specified locale is null, the default locale is used.

Specified by:
getAsText in class DateTimeField
Parameters:
fieldValue - the numeric value to convert to text
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsShortText

public String getAsShortText(long instant,
                             Locale locale)
Description copied from class: DateTimeField
Get the human-readable, short text value of this field from the milliseconds. If the specified locale is null, the default locale is used.

Specified by:
getAsShortText in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
locale - the locale to use for selecting a text symbol, null for default
Returns:
the short text value of the field

getAsShortText

public String getAsShortText(long instant)
Description copied from class: DateTimeField
Get the human-readable, short text value of this field from the milliseconds.

Specified by:
getAsShortText in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
Returns:
the short text value of the field

getAsShortText

public String getAsShortText(ReadablePartial partial,
                             int fieldValue,
                             Locale locale)
Description copied from class: DateTimeField
Get the human-readable, short text value of this field from a partial instant. If the specified locale is null, the default locale is used.

Specified by:
getAsShortText in class DateTimeField
Parameters:
partial - the partial instant to query
fieldValue - the field value of this field, provided for performance
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsShortText

public String getAsShortText(ReadablePartial partial,
                             Locale locale)
Description copied from class: DateTimeField
Get the human-readable, short text value of this field from a partial instant. If the specified locale is null, the default locale is used.

Specified by:
getAsShortText in class DateTimeField
Parameters:
partial - the partial instant to query
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

getAsShortText

public String getAsShortText(int fieldValue,
                             Locale locale)
Description copied from class: DateTimeField
Get the human-readable, short text value of this field from the field value. If the specified locale is null, the default locale is used.

Specified by:
getAsShortText in class DateTimeField
Parameters:
fieldValue - the numeric value to convert to text
locale - the locale to use for selecting a text symbol, null for default
Returns:
the text value of the field

add

public long add(long instant,
                int value)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the millis value, overflowing into larger fields if necessary.

The value will be added to this field. If the value is too large to be added solely to this field, larger fields will increase as required. Smaller fields should be unaffected, except where the result would be an invalid value for a smaller field. In this case the smaller field is adjusted to be in range.

For example, in the ISO chronology:
2000-08-20 add six months is 2001-02-20
2000-08-20 add twenty months is 2002-04-20
2000-08-20 add minus nine months is 1999-11-20
2001-01-31 add one month is 2001-02-28
2001-01-31 add two months is 2001-03-31

Specified by:
add in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to add to
value - the value to add, in the units of the field
Returns:
the updated milliseconds

add

public long add(long instant,
                long value)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the millis value, overflowing into larger fields if necessary.

Specified by:
add in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to add to
value - the long value to add, in the units of the field
Returns:
the updated milliseconds
See Also:
DateTimeField.add(long,int)

add

public int[] add(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 int valueToAdd)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the partial instant, throwing an exception if the maximum size of the instant is reached.

The value will be added to this field, overflowing into larger fields if necessary. Smaller fields should be unaffected, except where the result would be an invalid value for a smaller field. In this case the smaller field is adjusted to be in range.

Partial instants only contain some fields. This may result in a maximum possible value, such as TimeOfDay being limited to 23:59:59:999. If this limit is breached by the add an exception is thrown.

For example, in the ISO chronology:
2000-08-20 add six months is 2000-02-20
2000-08-20 add twenty months is 2000-04-20
2000-08-20 add minus nine months is 2000-11-20
2001-01-31 add one month is 2001-02-28
2001-01-31 add two months is 2001-03-31

Specified by:
add in class DateTimeField
Parameters:
instant - the partial instant
fieldIndex - the index of this field in the instant
values - the values of the partial instant which should be updated
valueToAdd - the value to add, in the units of the field
Returns:
the passed in values

addWrapPartial

public int[] addWrapPartial(ReadablePartial instant,
                            int fieldIndex,
                            int[] values,
                            int valueToAdd)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the partial instant, wrapping the whole partial if the maximum size of the partial is reached.

The value will be added to this field, overflowing into larger fields if necessary. Smaller fields should be unaffected, except where the result would be an invalid value for a smaller field. In this case the smaller field is adjusted to be in range.

Partial instants only contain some fields. This may result in a maximum possible value, such as TimeOfDay normally being limited to 23:59:59:999. If ths limit is reached by the addition, this method will wrap back to 00:00:00.000. In fact, you would generally only use this method for classes that have a limitation such as this.

For example, in the ISO chronology:
10:20:30 add 20 minutes is 10:40:30
10:20:30 add 45 minutes is 11:05:30
10:20:30 add 16 hours is 02:20:30

Specified by:
addWrapPartial in class DateTimeField
Parameters:
instant - the partial instant
fieldIndex - the index of this field in the partial
values - the values of the partial instant which should be updated
valueToAdd - the value to add, in the units of the field
Returns:
the passed in values

addWrapField

public long addWrapField(long instant,
                         int value)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the millis value, wrapping within this field.

The value will be added to this field. If the value is too large to be added solely to this field then it wraps. Larger fields are always unaffected. Smaller fields should be unaffected, except where the result would be an invalid value for a smaller field. In this case the smaller field is adjusted to be in range.

For example, in the ISO chronology:
2000-08-20 addWrapField six months is 2000-02-20
2000-08-20 addWrapField twenty months is 2000-04-20
2000-08-20 addWrapField minus nine months is 2000-11-20
2001-01-31 addWrapField one month is 2001-02-28
2001-01-31 addWrapField two months is 2001-03-31

Specified by:
addWrapField in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to add to
value - the value to add, in the units of the field
Returns:
the updated milliseconds

addWrapField

public int[] addWrapField(ReadablePartial instant,
                          int fieldIndex,
                          int[] values,
                          int valueToAdd)
Description copied from class: DateTimeField
Adds a value (which may be negative) to the partial instant, wrapping within this field.

The value will be added to this field. If the value is too large to be added solely to this field then it wraps. Larger fields are always unaffected. Smaller fields should be unaffected, except where the result would be an invalid value for a smaller field. In this case the smaller field is adjusted to be in range.

For example, in the ISO chronology:
2000-08-20 addWrapField six months is 2000-02-20
2000-08-20 addWrapField twenty months is 2000-04-20
2000-08-20 addWrapField minus nine months is 2000-11-20
2001-01-31 addWrapField one month is 2001-02-28
2001-01-31 addWrapField two months is 2001-03-31

Specified by:
addWrapField in class DateTimeField
Parameters:
instant - the partial instant
fieldIndex - the index of this field in the instant
values - the values of the partial instant which should be updated
valueToAdd - the value to add, in the units of the field
Returns:
the passed in values

getDifference

public int getDifference(long minuendInstant,
                         long subtrahendInstant)
Description copied from class: DateTimeField
Computes the difference between two instants, as measured in the units of this field. Any fractional units are dropped from the result. Calling getDifference reverses the effect of calling add. In the following code:
 long instant = ...
 int v = ...
 int age = getDifference(add(instant, v), instant);
 
The value 'age' is the same as the value 'v'.

Specified by:
getDifference in class DateTimeField
Parameters:
minuendInstant - the milliseconds from 1970-01-01T00:00:00Z to subtract from
subtrahendInstant - the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend
Returns:
the difference in the units of this field

getDifferenceAsLong

public long getDifferenceAsLong(long minuendInstant,
                                long subtrahendInstant)
Description copied from class: DateTimeField
Computes the difference between two instants, as measured in the units of this field. Any fractional units are dropped from the result. Calling getDifference reverses the effect of calling add. In the following code:
 long instant = ...
 long v = ...
 long age = getDifferenceAsLong(add(instant, v), instant);
 
The value 'age' is the same as the value 'v'.

Specified by:
getDifferenceAsLong in class DateTimeField
Parameters:
minuendInstant - the milliseconds from 1970-01-01T00:00:00Z to subtract from
subtrahendInstant - the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend
Returns:
the difference in the units of this field

set

public long set(long instant,
                int value)
Description copied from class: DateTimeField
Sets a value in the milliseconds supplied.

The value of this field will be set. If the value is invalid, an exception if thrown.

If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.

Specified by:
set in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to set in
value - the value to set, in the units of the field
Returns:
the updated milliseconds

set

public long set(long instant,
                String text,
                Locale locale)
Description copied from class: DateTimeField
Sets a value in the milliseconds supplied from a human-readable, text value. If the specified locale is null, the default locale is used.

If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.

Specified by:
set in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to set in
text - the text value to set
locale - the locale to use for selecting a text symbol, null for default
Returns:
the updated milliseconds

set

public long set(long instant,
                String text)
Description copied from class: DateTimeField
Sets a value in the milliseconds supplied from a human-readable, text value.

If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.

Specified by:
set in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to set in
text - the text value to set
Returns:
the updated milliseconds

set

public int[] set(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 int newValue)
Description copied from class: DateTimeField
Sets a value using the specified partial instant.

The value of this field (specified by the index) will be set. If the value is invalid, an exception if thrown.

If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.

Specified by:
set in class DateTimeField
Parameters:
instant - the partial instant
fieldIndex - the index of this field in the instant
values - the values of the partial instant which should be updated
newValue - the value to set, in the units of the field
Returns:
the passed in values

set

public int[] set(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 String text,
                 Locale locale)
Description copied from class: DateTimeField
Sets a value in the milliseconds supplied from a human-readable, text value. If the specified locale is null, the default locale is used.

If setting this field would make other fields invalid, then those fields may be changed. For example if the current date is the 31st January, and the month is set to February, the day would be invalid. Instead, the day would be changed to the closest value - the 28th/29th February as appropriate.

Specified by:
set in class DateTimeField
Parameters:
instant - the partial instant
fieldIndex - the index of this field in the instant
values - the values of the partial instant which should be updated
text - the text value to set
locale - the locale to use for selecting a text symbol, null for default
Returns:
the passed in values

getDurationField

public DurationField getDurationField()
Description copied from class: DateTimeField
Returns the duration per unit value of this field. For example, if this field represents "hour of day", then the duration is an hour.

Specified by:
getDurationField in class DateTimeField
Returns:
the duration of this field, or UnsupportedDurationField if field has no duration

getRangeDurationField

public DurationField getRangeDurationField()
Description copied from class: DateTimeField
Returns the range duration of this field. For example, if this field represents "hour of day", then the range duration is a day.

Specified by:
getRangeDurationField in class DateTimeField
Returns:
the range duration of this field, or null if field has no range

isLeap

public boolean isLeap(long instant)
Description copied from class: DateTimeField
Returns whether this field is 'leap' for the specified instant.

For example, a leap year would return true, a non leap year would return false.

Specified by:
isLeap in class DateTimeField
Parameters:
instant - the instant to check for leap status
Returns:
true if the field is 'leap'

getLeapAmount

public int getLeapAmount(long instant)
Description copied from class: DateTimeField
Gets the amount by which this field is 'leap' for the specified instant.

For example, a leap year would return one, a non leap year would return zero.

Specified by:
getLeapAmount in class DateTimeField
Parameters:
instant - the instant to check for leap status
Returns:
the amount, in units of the leap duration field, that the field is leap

getLeapDurationField

public DurationField getLeapDurationField()
Description copied from class: DateTimeField
If this field were to leap, then it would be in units described by the returned duration. If this field doesn't ever leap, null is returned.

Specified by:
getLeapDurationField in class DateTimeField
Returns:
the leap duration field if field can be leap, null if it can't

getMinimumValue

public int getMinimumValue()
Description copied from class: DateTimeField
Get the minimum allowable value for this field.

Specified by:
getMinimumValue in class DateTimeField
Returns:
the minimum valid value for this field, in the units of the field

getMinimumValue

public int getMinimumValue(long instant)
Description copied from class: DateTimeField
Get the minimum value for this field evaluated at the specified time.

Specified by:
getMinimumValue in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
Returns:
the minimum value for this field, in the units of the field

getMinimumValue

public int getMinimumValue(ReadablePartial instant)
Description copied from class: DateTimeField
Get the minimum value for this field evaluated at the specified time.

Specified by:
getMinimumValue in class DateTimeField
Parameters:
instant - the partial instant to query
Returns:
the minimum value for this field, in the units of the field

getMinimumValue

public int getMinimumValue(ReadablePartial instant,
                           int[] values)
Description copied from class: DateTimeField
Get the minimum value for this field using the partial instant and the specified values.

Specified by:
getMinimumValue in class DateTimeField
Parameters:
instant - the partial instant to query
values - the values to use
Returns:
the minimum value for this field, in the units of the field

getMaximumValue

public int getMaximumValue()
Description copied from class: DateTimeField
Get the maximum allowable value for this field.

Specified by:
getMaximumValue in class DateTimeField
Returns:
the maximum valid value for this field, in the units of the field

getMaximumValue

public int getMaximumValue(long instant)
Description copied from class: DateTimeField
Get the maximum value for this field evaluated at the specified time.

Specified by:
getMaximumValue in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to query
Returns:
the maximum value for this field, in the units of the field

getMaximumValue

public int getMaximumValue(ReadablePartial instant)
Description copied from class: DateTimeField
Get the maximum value for this field evaluated at the specified time.

Specified by:
getMaximumValue in class DateTimeField
Parameters:
instant - the partial instant to query
Returns:
the maximum value for this field, in the units of the field

getMaximumValue

public int getMaximumValue(ReadablePartial instant,
                           int[] values)
Description copied from class: DateTimeField
Get the maximum value for this field using the partial instant and the specified values.

Specified by:
getMaximumValue in class DateTimeField
Parameters:
instant - the partial instant to query
values - the values to use
Returns:
the maximum value for this field, in the units of the field

getMaximumTextLength

public int getMaximumTextLength(Locale locale)
Description copied from class: DateTimeField
Get the maximum text value for this field.

Specified by:
getMaximumTextLength in class DateTimeField
Parameters:
locale - the locale to use for selecting a text symbol
Returns:
the maximum text length

getMaximumShortTextLength

public int getMaximumShortTextLength(Locale locale)
Description copied from class: DateTimeField
Get the maximum short text value for this field.

Specified by:
getMaximumShortTextLength in class DateTimeField
Parameters:
locale - the locale to use for selecting a text symbol
Returns:
the maximum short text length

roundFloor

public long roundFloor(long instant)
Description copied from class: DateTimeField
Round to the lowest whole unit of this field. After rounding, the value of this field and all fields of a higher magnitude are retained. The fractional millis that cannot be expressed in whole increments of this field are set to minimum.

For example, a datetime of 2002-11-02T23:34:56.789, rounded to the lowest whole hour is 2002-11-02T23:00:00.000.

Specified by:
roundFloor in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to round
Returns:
rounded milliseconds

roundCeiling

public long roundCeiling(long instant)
Description copied from class: DateTimeField
Round to the highest whole unit of this field. The value of this field and all fields of a higher magnitude may be incremented in order to achieve this result. The fractional millis that cannot be expressed in whole increments of this field are set to minimum.

For example, a datetime of 2002-11-02T23:34:56.789, rounded to the highest whole hour is 2002-11-03T00:00:00.000.

Specified by:
roundCeiling in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to round
Returns:
rounded milliseconds

roundHalfFloor

public long roundHalfFloor(long instant)
Description copied from class: DateTimeField
Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor or is exactly halfway, this function behaves like roundFloor. If the millisecond value is closer to the ceiling, this function behaves like roundCeiling.

Specified by:
roundHalfFloor in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to round
Returns:
rounded milliseconds

roundHalfCeiling

public long roundHalfCeiling(long instant)
Description copied from class: DateTimeField
Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like roundFloor. If the millisecond value is closer to the ceiling or is exactly halfway, this function behaves like roundCeiling.

Specified by:
roundHalfCeiling in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to round
Returns:
rounded milliseconds

roundHalfEven

public long roundHalfEven(long instant)
Description copied from class: DateTimeField
Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like roundFloor. If the millisecond value is closer to the ceiling, this function behaves like roundCeiling.

If the millisecond value is exactly halfway between the floor and ceiling, the ceiling is chosen over the floor only if it makes this field's value even.

Specified by:
roundHalfEven in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to round
Returns:
rounded milliseconds

remainder

public long remainder(long instant)
Description copied from class: DateTimeField
Returns the fractional duration milliseconds of this field. In other words, calling remainder returns the duration that roundFloor would subtract.

For example, on a datetime of 2002-11-02T23:34:56.789, the remainder by hour is 34 minutes and 56.789 seconds.

Specified by:
remainder in class DateTimeField
Parameters:
instant - the milliseconds from 1970-01-01T00:00:00Z to get the remainder
Returns:
remainder duration, in milliseconds

toString

public String toString()
Description copied from class: DateTimeField
Get a suitable debug string.

Specified by:
toString in class DateTimeField
Returns:
debug string


Copyright © 2002-2013 Joda.org. All Rights Reserved.