Class 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 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
      java.lang.String getAsShortText​(int fieldValue, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsShortText​(long instant)
      Always throws UnsupportedOperationException
      java.lang.String getAsShortText​(long instant, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsShortText​(ReadablePartial partial, int fieldValue, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsShortText​(ReadablePartial partial, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsText​(int fieldValue, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsText​(long instant)
      Always throws UnsupportedOperationException
      java.lang.String getAsText​(long instant, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsText​(ReadablePartial partial, int fieldValue, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String getAsText​(ReadablePartial partial, java.util.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​(java.util.Locale locale)
      Always throws UnsupportedOperationException
      int getMaximumTextLength​(java.util.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
      java.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 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, java.lang.String text)
      Always throws UnsupportedOperationException
      long set​(long instant, java.lang.String text, java.util.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, java.lang.String text, java.util.Locale locale)
      Always throws UnsupportedOperationException
      java.lang.String toString()
      Get a suitable debug string.
      • Methods inherited from class java.lang.Object

        equals, 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:
        java.lang.IllegalArgumentException - if durationField is null
      • 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 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:
        java.lang.UnsupportedOperationException
      • getAsText

        public java.lang.String getAsText​(long instant,
                                          java.util.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:
        java.lang.UnsupportedOperationException
      • getAsText

        public java.lang.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:
        java.lang.UnsupportedOperationException
      • getAsText

        public java.lang.String getAsText​(ReadablePartial partial,
                                          int fieldValue,
                                          java.util.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:
        java.lang.UnsupportedOperationException
      • getAsText

        public java.lang.String getAsText​(ReadablePartial partial,
                                          java.util.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:
        java.lang.UnsupportedOperationException
      • getAsText

        public java.lang.String getAsText​(int fieldValue,
                                          java.util.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:
        java.lang.UnsupportedOperationException
      • getAsShortText

        public java.lang.String getAsShortText​(long instant,
                                               java.util.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:
        java.lang.UnsupportedOperationException
      • getAsShortText

        public java.lang.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:
        java.lang.UnsupportedOperationException
      • getAsShortText

        public java.lang.String getAsShortText​(ReadablePartial partial,
                                               int fieldValue,
                                               java.util.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:
        java.lang.UnsupportedOperationException
      • getAsShortText

        public java.lang.String getAsShortText​(ReadablePartial partial,
                                               java.util.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:
        java.lang.UnsupportedOperationException
      • getAsShortText

        public java.lang.String getAsShortText​(int fieldValue,
                                               java.util.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:
        java.lang.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:
        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 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:
        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 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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        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 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:
        java.lang.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:
        java.lang.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:
        java.lang.UnsupportedOperationException
      • set

        public long set​(long instant,
                        java.lang.String text,
                        java.util.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:
        java.lang.UnsupportedOperationException
      • set

        public long set​(long instant,
                        java.lang.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:
        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 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:
        java.lang.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
      • 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:
        java.lang.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:
        java.lang.UnsupportedOperationException
      • 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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.UnsupportedOperationException
      • getMaximumTextLength

        public int getMaximumTextLength​(java.util.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:
        java.lang.UnsupportedOperationException
      • getMaximumShortTextLength

        public int getMaximumShortTextLength​(java.util.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.UnsupportedOperationException
      • toString

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