org.joda.time.field
Class UnsupportedDateTimeField

java.lang.Object
  extended by org.joda.time.DateTimeField
      extended by org.joda.time.field.UnsupportedDateTimeField
All Implemented Interfaces:
Serializable

public final class UnsupportedDateTimeField
extends DateTimeField
implements Serializable

A placeholder implementation to use when a datetime field is not supported.

UnsupportedDateTimeField is thread-safe and immutable.

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

Method Summary
 long add(long instant, int value)
          Delegates to the duration field.
 long add(long instant, long value)
          Delegates to the duration field.
 int[] add(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Always throws UnsupportedOperationException
 long addWrapField(long instant, int value)
          Always throws UnsupportedOperationException
 int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Always throws UnsupportedOperationException
 int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
          Always throws UnsupportedOperationException
 int get(long instant)
          Always throws UnsupportedOperationException
 String getAsShortText(int fieldValue, Locale locale)
          Always throws UnsupportedOperationException
 String getAsShortText(long instant)
          Always throws UnsupportedOperationException
 String getAsShortText(long instant, Locale locale)
          Always throws UnsupportedOperationException
 String getAsShortText(ReadablePartial partial, int fieldValue, Locale locale)
          Always throws UnsupportedOperationException
 String getAsShortText(ReadablePartial partial, Locale locale)
          Always throws UnsupportedOperationException
 String getAsText(int fieldValue, Locale locale)
          Always throws UnsupportedOperationException
 String getAsText(long instant)
          Always throws UnsupportedOperationException
 String getAsText(long instant, Locale locale)
          Always throws UnsupportedOperationException
 String getAsText(ReadablePartial partial, int fieldValue, Locale locale)
          Always throws UnsupportedOperationException
 String getAsText(ReadablePartial partial, Locale locale)
          Always throws UnsupportedOperationException
 int getDifference(long minuendInstant, long subtrahendInstant)
          Delegates to the duration field.
 long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)
          Delegates to the duration field.
 DurationField getDurationField()
          Even though this DateTimeField is unsupported, the duration field might be supported.
static UnsupportedDateTimeField getInstance(DateTimeFieldType type, DurationField durationField)
          Gets an instance of UnsupportedDateTimeField for a specific named field.
 int getLeapAmount(long instant)
          Always throws UnsupportedOperationException
 DurationField getLeapDurationField()
          Always returns null.
 int getMaximumShortTextLength(Locale locale)
          Always throws UnsupportedOperationException
 int getMaximumTextLength(Locale locale)
          Always throws UnsupportedOperationException
 int getMaximumValue()
          Always throws UnsupportedOperationException
 int getMaximumValue(long instant)
          Always throws UnsupportedOperationException
 int getMaximumValue(ReadablePartial instant)
          Always throws UnsupportedOperationException
 int getMaximumValue(ReadablePartial instant, int[] values)
          Always throws UnsupportedOperationException
 int getMinimumValue()
          Always throws UnsupportedOperationException
 int getMinimumValue(long instant)
          Always throws UnsupportedOperationException
 int getMinimumValue(ReadablePartial instant)
          Always throws UnsupportedOperationException
 int getMinimumValue(ReadablePartial instant, int[] values)
          Always throws UnsupportedOperationException
 String getName()
          Get the name of the field.
 DurationField getRangeDurationField()
          Always returns null.
 DateTimeFieldType getType()
          Get the type of the field.
 boolean isLeap(long instant)
          Always throws UnsupportedOperationException
 boolean isLenient()
          This field is not lenient.
 boolean isSupported()
          This field is not supported.
 long remainder(long instant)
          Always throws UnsupportedOperationException
 long roundCeiling(long instant)
          Always throws UnsupportedOperationException
 long roundFloor(long instant)
          Always throws UnsupportedOperationException
 long roundHalfCeiling(long instant)
          Always throws UnsupportedOperationException
 long roundHalfEven(long instant)
          Always throws UnsupportedOperationException
 long roundHalfFloor(long instant)
          Always throws UnsupportedOperationException
 long set(long instant, int value)
          Always throws UnsupportedOperationException
 long set(long instant, String text)
          Always throws UnsupportedOperationException
 long set(long instant, String text, Locale locale)
          Always throws UnsupportedOperationException
 int[] set(ReadablePartial instant, int fieldIndex, int[] values, int newValue)
          Always throws UnsupportedOperationException
 int[] set(ReadablePartial instant, int fieldIndex, int[] values, String text, Locale locale)
          Always throws UnsupportedOperationException
 String toString()
          Get a suitable debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static UnsupportedDateTimeField getInstance(DateTimeFieldType type,
                                                   DurationField durationField)
Gets an instance of UnsupportedDateTimeField for a specific named field. Names should be of standard format, such as 'monthOfYear' or 'hourOfDay'. The returned instance is cached.

Parameters:
type - the type to obtain
Returns:
the instance
Throws:
IllegalArgumentException - if durationField is null

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()
This field is not supported.

Specified by:
isSupported in class DateTimeField
Returns:
false always

isLenient

public boolean isLenient()
This field is not lenient.

Specified by:
isLenient in class DateTimeField
Returns:
false always

get

public int get(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsText

public String getAsText(long instant,
                        Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsText

public String getAsText(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsText

public String getAsText(ReadablePartial partial,
                        int fieldValue,
                        Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsText

public String getAsText(ReadablePartial partial,
                        Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsText

public String getAsText(int fieldValue,
                        Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsShortText

public String getAsShortText(long instant,
                             Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsShortText

public String getAsShortText(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsShortText

public String getAsShortText(ReadablePartial partial,
                             int fieldValue,
                             Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsShortText

public String getAsShortText(ReadablePartial partial,
                             Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getAsShortText

public String getAsShortText(int fieldValue,
                             Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

add

public long add(long instant,
                int value)
Delegates to the duration field.

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
Throws:
UnsupportedOperationException - if the duration is unsupported

add

public long add(long instant,
                long value)
Delegates to the duration field.

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
Throws:
UnsupportedOperationException - if the duration is unsupported
See Also:
DateTimeField.add(long,int)

add

public int[] add(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 int valueToAdd)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

addWrapPartial

public int[] addWrapPartial(ReadablePartial instant,
                            int fieldIndex,
                            int[] values,
                            int valueToAdd)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

addWrapField

public long addWrapField(long instant,
                         int value)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

addWrapField

public int[] addWrapField(ReadablePartial instant,
                          int fieldIndex,
                          int[] values,
                          int valueToAdd)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getDifference

public int getDifference(long minuendInstant,
                         long subtrahendInstant)
Delegates to the duration field.

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
Throws:
UnsupportedOperationException - if the duration is unsupported

getDifferenceAsLong

public long getDifferenceAsLong(long minuendInstant,
                                long subtrahendInstant)
Delegates to the duration field.

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
Throws:
UnsupportedOperationException - if the duration is unsupported

set

public long set(long instant,
                int value)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

set

public int[] set(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 int newValue)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

set

public long set(long instant,
                String text,
                Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

set

public long set(long instant,
                String text)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

set

public int[] set(ReadablePartial instant,
                 int fieldIndex,
                 int[] values,
                 String text,
                 Locale locale)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getDurationField

public DurationField getDurationField()
Even though this DateTimeField is unsupported, the duration field might be supported.

Specified by:
getDurationField in class DateTimeField
Returns:
a possibly supported DurationField

getRangeDurationField

public DurationField getRangeDurationField()
Always returns null.

Specified by:
getRangeDurationField in class DateTimeField
Returns:
null always

isLeap

public boolean isLeap(long instant)
Always throws UnsupportedOperationException

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

getLeapAmount

public int getLeapAmount(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getLeapDurationField

public DurationField getLeapDurationField()
Always returns null.

Specified by:
getLeapDurationField in class DateTimeField
Returns:
null always

getMinimumValue

public int getMinimumValue()
Always throws UnsupportedOperationException

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

getMinimumValue

public int getMinimumValue(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMinimumValue

public int getMinimumValue(ReadablePartial instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMinimumValue

public int getMinimumValue(ReadablePartial instant,
                           int[] values)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMaximumValue

public int getMaximumValue()
Always throws UnsupportedOperationException

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

getMaximumValue

public int getMaximumValue(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMaximumValue

public int getMaximumValue(ReadablePartial instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMaximumValue

public int getMaximumValue(ReadablePartial instant,
                           int[] values)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

getMaximumTextLength

public int getMaximumTextLength(Locale locale)
Always throws UnsupportedOperationException

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

getMaximumShortTextLength

public int getMaximumShortTextLength(Locale locale)
Always throws UnsupportedOperationException

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

roundFloor

public long roundFloor(long instant)
Always throws UnsupportedOperationException

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

roundCeiling

public long roundCeiling(long instant)
Always throws UnsupportedOperationException

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

roundHalfFloor

public long roundHalfFloor(long instant)
Always throws UnsupportedOperationException

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

roundHalfCeiling

public long roundHalfCeiling(long instant)
Always throws UnsupportedOperationException

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

roundHalfEven

public long roundHalfEven(long instant)
Always throws UnsupportedOperationException

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

remainder

public long remainder(long instant)
Always throws UnsupportedOperationException

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
Throws:
UnsupportedOperationException

toString

public String toString()
Get a suitable debug string.

Specified by:
toString in class DateTimeField
Returns:
debug string


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