Class UnsupportedDateTimeField

java.lang.Object
org.joda.time.DateTimeField
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:
  • Method Details

    • 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
      durationField - the duration field
      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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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:
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • 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 - as this is not supported
    • toString

      public String toString()
      Get a suitable debug string.
      Specified by:
      toString in class DateTimeField
      Returns:
      debug string