Package org.joda.time.field
Class UnsupportedDateTimeField
- java.lang.Object
-
- org.joda.time.DateTimeField
-
- org.joda.time.field.UnsupportedDateTimeField
-
- All Implemented Interfaces:
java.io.Serializable
public final class UnsupportedDateTimeField extends DateTimeField implements java.io.Serializable
A placeholder implementation to use when a datetime field is not supported.UnsupportedDateTimeField is thread-safe and immutable.
- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 UnsupportedOperationExceptionlong
addWrapField(long instant, int value)
Always throws UnsupportedOperationExceptionint[]
addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
Always throws UnsupportedOperationExceptionint[]
addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
Always throws UnsupportedOperationExceptionint
get(long instant)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsShortText(int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsShortText(long instant)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsShortText(long instant, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsShortText(ReadablePartial partial, int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsShortText(ReadablePartial partial, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsText(int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsText(long instant)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsText(long instant, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsText(ReadablePartial partial, int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
getAsText(ReadablePartial partial, java.util.Locale locale)
Always throws UnsupportedOperationExceptionint
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 UnsupportedOperationExceptionDurationField
getLeapDurationField()
Always returns null.int
getMaximumShortTextLength(java.util.Locale locale)
Always throws UnsupportedOperationExceptionint
getMaximumTextLength(java.util.Locale locale)
Always throws UnsupportedOperationExceptionint
getMaximumValue()
Always throws UnsupportedOperationExceptionint
getMaximumValue(long instant)
Always throws UnsupportedOperationExceptionint
getMaximumValue(ReadablePartial instant)
Always throws UnsupportedOperationExceptionint
getMaximumValue(ReadablePartial instant, int[] values)
Always throws UnsupportedOperationExceptionint
getMinimumValue()
Always throws UnsupportedOperationExceptionint
getMinimumValue(long instant)
Always throws UnsupportedOperationExceptionint
getMinimumValue(ReadablePartial instant)
Always throws UnsupportedOperationExceptionint
getMinimumValue(ReadablePartial instant, int[] values)
Always throws UnsupportedOperationExceptionjava.lang.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 UnsupportedOperationExceptionboolean
isLenient()
This field is not lenient.boolean
isSupported()
This field is not supported.long
remainder(long instant)
Always throws UnsupportedOperationExceptionlong
roundCeiling(long instant)
Always throws UnsupportedOperationExceptionlong
roundFloor(long instant)
Always throws UnsupportedOperationExceptionlong
roundHalfCeiling(long instant)
Always throws UnsupportedOperationExceptionlong
roundHalfEven(long instant)
Always throws UnsupportedOperationExceptionlong
roundHalfFloor(long instant)
Always throws UnsupportedOperationExceptionlong
set(long instant, int value)
Always throws UnsupportedOperationExceptionlong
set(long instant, java.lang.String text)
Always throws UnsupportedOperationExceptionlong
set(long instant, java.lang.String text, java.util.Locale locale)
Always throws UnsupportedOperationExceptionint[]
set(ReadablePartial instant, int fieldIndex, int[] values, int newValue)
Always throws UnsupportedOperationExceptionint[]
set(ReadablePartial instant, int fieldIndex, int[] values, java.lang.String text, java.util.Locale locale)
Always throws UnsupportedOperationExceptionjava.lang.String
toString()
Get a suitable debug string.-
Methods inherited from class org.joda.time.DateTimeField
setExtended
-
-
-
-
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:
java.lang.IllegalArgumentException
- if durationField is null
-
getType
public DateTimeFieldType getType()
Description copied from class:DateTimeField
Get the type of the field.- Specified by:
getType
in classDateTimeField
- Returns:
- field type
-
getName
public java.lang.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 classDateTimeField
- Returns:
- field name
-
isSupported
public boolean isSupported()
This field is not supported.- Specified by:
isSupported
in classDateTimeField
- Returns:
- false always
-
isLenient
public boolean isLenient()
This field is not lenient.- Specified by:
isLenient
in classDateTimeField
- Returns:
- false always
-
get
public int get(long instant)
Always throws UnsupportedOperationException- Specified by:
get
in classDateTimeField
- 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:
java.lang.UnsupportedOperationException
-
getAsText
public java.lang.String getAsText(long instant, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsText
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to querylocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsText
public java.lang.String getAsText(long instant)
Always throws UnsupportedOperationException- Specified by:
getAsText
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to query- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsText
public java.lang.String getAsText(ReadablePartial partial, int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsText
in classDateTimeField
- Parameters:
partial
- the partial instant to queryfieldValue
- the field value of this field, provided for performancelocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsText
public java.lang.String getAsText(ReadablePartial partial, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsText
in classDateTimeField
- Parameters:
partial
- the partial instant to querylocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsText
public java.lang.String getAsText(int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsText
in classDateTimeField
- Parameters:
fieldValue
- the numeric value to convert to textlocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsShortText
public java.lang.String getAsShortText(long instant, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsShortText
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to querylocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the short text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsShortText
public java.lang.String getAsShortText(long instant)
Always throws UnsupportedOperationException- Specified by:
getAsShortText
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to query- Returns:
- the short text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsShortText
public java.lang.String getAsShortText(ReadablePartial partial, int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsShortText
in classDateTimeField
- Parameters:
partial
- the partial instant to queryfieldValue
- the field value of this field, provided for performancelocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsShortText
public java.lang.String getAsShortText(ReadablePartial partial, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsShortText
in classDateTimeField
- Parameters:
partial
- the partial instant to querylocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
getAsShortText
public java.lang.String getAsShortText(int fieldValue, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getAsShortText
in classDateTimeField
- Parameters:
fieldValue
- the numeric value to convert to textlocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the text value of the field
- Throws:
java.lang.UnsupportedOperationException
-
add
public long add(long instant, int value)
Delegates to the duration field.- Specified by:
add
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to add tovalue
- the value to add, in the units of the field- Returns:
- the updated milliseconds
- Throws:
java.lang.UnsupportedOperationException
- if the duration is unsupported
-
add
public long add(long instant, long value)
Delegates to the duration field.- Specified by:
add
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to add tovalue
- the long value to add, in the units of the field- Returns:
- the updated milliseconds
- Throws:
java.lang.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 classDateTimeField
- Parameters:
instant
- the partial instantfieldIndex
- the index of this field in the instantvalues
- the values of the partial instant which should be updatedvalueToAdd
- the value to add, in the units of the field- Returns:
- the passed in values
- Throws:
java.lang.UnsupportedOperationException
-
addWrapPartial
public int[] addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
Always throws UnsupportedOperationException- Specified by:
addWrapPartial
in classDateTimeField
- Parameters:
instant
- the partial instantfieldIndex
- the index of this field in the partialvalues
- the values of the partial instant which should be updatedvalueToAdd
- the value to add, in the units of the field- Returns:
- the passed in values
- Throws:
java.lang.UnsupportedOperationException
-
addWrapField
public long addWrapField(long instant, int value)
Always throws UnsupportedOperationException- Specified by:
addWrapField
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to add tovalue
- the value to add, in the units of the field- Returns:
- the updated milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
addWrapField
public int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int valueToAdd)
Always throws UnsupportedOperationException- Specified by:
addWrapField
in classDateTimeField
- Parameters:
instant
- the partial instantfieldIndex
- the index of this field in the instantvalues
- the values of the partial instant which should be updatedvalueToAdd
- the value to add, in the units of the field- Returns:
- the passed in values
- Throws:
java.lang.UnsupportedOperationException
-
getDifference
public int getDifference(long minuendInstant, long subtrahendInstant)
Delegates to the duration field.- Specified by:
getDifference
in classDateTimeField
- Parameters:
minuendInstant
- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant
- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
- Throws:
java.lang.UnsupportedOperationException
- if the duration is unsupported
-
getDifferenceAsLong
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant)
Delegates to the duration field.- Specified by:
getDifferenceAsLong
in classDateTimeField
- Parameters:
minuendInstant
- the milliseconds from 1970-01-01T00:00:00Z to subtract fromsubtrahendInstant
- the milliseconds from 1970-01-01T00:00:00Z to subtract off the minuend- Returns:
- the difference in the units of this field
- Throws:
java.lang.UnsupportedOperationException
- if the duration is unsupported
-
set
public long set(long instant, int value)
Always throws UnsupportedOperationException- Specified by:
set
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to set invalue
- the value to set, in the units of the field- Returns:
- the updated milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
set
public int[] set(ReadablePartial instant, int fieldIndex, int[] values, int newValue)
Always throws UnsupportedOperationException- Specified by:
set
in classDateTimeField
- Parameters:
instant
- the partial instantfieldIndex
- the index of this field in the instantvalues
- the values of the partial instant which should be updatednewValue
- the value to set, in the units of the field- Returns:
- the passed in values
- Throws:
java.lang.UnsupportedOperationException
-
set
public long set(long instant, java.lang.String text, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
set
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to set intext
- the text value to setlocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the updated milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
set
public long set(long instant, java.lang.String text)
Always throws UnsupportedOperationException- Specified by:
set
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to set intext
- the text value to set- Returns:
- the updated milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
set
public int[] set(ReadablePartial instant, int fieldIndex, int[] values, java.lang.String text, java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
set
in classDateTimeField
- Parameters:
instant
- the partial instantfieldIndex
- the index of this field in the instantvalues
- the values of the partial instant which should be updatedtext
- the text value to setlocale
- the locale to use for selecting a text symbol, null for default- Returns:
- the passed in values
- Throws:
java.lang.UnsupportedOperationException
-
getDurationField
public DurationField getDurationField()
Even though this DateTimeField is unsupported, the duration field might be supported.- Specified by:
getDurationField
in classDateTimeField
- Returns:
- a possibly supported DurationField
-
getRangeDurationField
public DurationField getRangeDurationField()
Always returns null.- Specified by:
getRangeDurationField
in classDateTimeField
- Returns:
- null always
-
isLeap
public boolean isLeap(long instant)
Always throws UnsupportedOperationException- Specified by:
isLeap
in classDateTimeField
- Parameters:
instant
- the instant to check for leap status- Returns:
- true if the field is 'leap'
- Throws:
java.lang.UnsupportedOperationException
-
getLeapAmount
public int getLeapAmount(long instant)
Always throws UnsupportedOperationException- Specified by:
getLeapAmount
in classDateTimeField
- 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:
java.lang.UnsupportedOperationException
-
getLeapDurationField
public DurationField getLeapDurationField()
Always returns null.- Specified by:
getLeapDurationField
in classDateTimeField
- Returns:
- null always
-
getMinimumValue
public int getMinimumValue()
Always throws UnsupportedOperationException- Specified by:
getMinimumValue
in classDateTimeField
- Returns:
- the minimum valid value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMinimumValue
public int getMinimumValue(long instant)
Always throws UnsupportedOperationException- Specified by:
getMinimumValue
in classDateTimeField
- 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:
java.lang.UnsupportedOperationException
-
getMinimumValue
public int getMinimumValue(ReadablePartial instant)
Always throws UnsupportedOperationException- Specified by:
getMinimumValue
in classDateTimeField
- Parameters:
instant
- the partial instant to query- Returns:
- the minimum value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMinimumValue
public int getMinimumValue(ReadablePartial instant, int[] values)
Always throws UnsupportedOperationException- Specified by:
getMinimumValue
in classDateTimeField
- Parameters:
instant
- the partial instant to queryvalues
- the values to use- Returns:
- the minimum value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMaximumValue
public int getMaximumValue()
Always throws UnsupportedOperationException- Specified by:
getMaximumValue
in classDateTimeField
- Returns:
- the maximum valid value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMaximumValue
public int getMaximumValue(long instant)
Always throws UnsupportedOperationException- Specified by:
getMaximumValue
in classDateTimeField
- 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:
java.lang.UnsupportedOperationException
-
getMaximumValue
public int getMaximumValue(ReadablePartial instant)
Always throws UnsupportedOperationException- Specified by:
getMaximumValue
in classDateTimeField
- Parameters:
instant
- the partial instant to query- Returns:
- the maximum value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMaximumValue
public int getMaximumValue(ReadablePartial instant, int[] values)
Always throws UnsupportedOperationException- Specified by:
getMaximumValue
in classDateTimeField
- Parameters:
instant
- the partial instant to queryvalues
- the values to use- Returns:
- the maximum value for this field, in the units of the field
- Throws:
java.lang.UnsupportedOperationException
-
getMaximumTextLength
public int getMaximumTextLength(java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getMaximumTextLength
in classDateTimeField
- Parameters:
locale
- the locale to use for selecting a text symbol- Returns:
- the maximum text length
- Throws:
java.lang.UnsupportedOperationException
-
getMaximumShortTextLength
public int getMaximumShortTextLength(java.util.Locale locale)
Always throws UnsupportedOperationException- Specified by:
getMaximumShortTextLength
in classDateTimeField
- Parameters:
locale
- the locale to use for selecting a text symbol- Returns:
- the maximum short text length
- Throws:
java.lang.UnsupportedOperationException
-
roundFloor
public long roundFloor(long instant)
Always throws UnsupportedOperationException- Specified by:
roundFloor
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to round- Returns:
- rounded milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
roundCeiling
public long roundCeiling(long instant)
Always throws UnsupportedOperationException- Specified by:
roundCeiling
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to round- Returns:
- rounded milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
roundHalfFloor
public long roundHalfFloor(long instant)
Always throws UnsupportedOperationException- Specified by:
roundHalfFloor
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to round- Returns:
- rounded milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
roundHalfCeiling
public long roundHalfCeiling(long instant)
Always throws UnsupportedOperationException- Specified by:
roundHalfCeiling
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to round- Returns:
- rounded milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
roundHalfEven
public long roundHalfEven(long instant)
Always throws UnsupportedOperationException- Specified by:
roundHalfEven
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to round- Returns:
- rounded milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
remainder
public long remainder(long instant)
Always throws UnsupportedOperationException- Specified by:
remainder
in classDateTimeField
- Parameters:
instant
- the milliseconds from 1970-01-01T00:00:00Z to get the remainder- Returns:
- remainder duration, in milliseconds
- Throws:
java.lang.UnsupportedOperationException
-
toString
public java.lang.String toString()
Get a suitable debug string.- Specified by:
toString
in classDateTimeField
- Returns:
- debug string
-
-