Package org.joda.time.field
Class UnsupportedDurationField
java.lang.Object
org.joda.time.DurationField
org.joda.time.field.UnsupportedDurationField
- All Implemented Interfaces:
Serializable,Comparable<DurationField>
A placeholder implementation to use when a duration field is not supported.
UnsupportedDurationField is thread-safe and immutable.
- Since:
- 1.0
- Author:
- Brian S O'Neill
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongadd(long instant, int value) Always throws UnsupportedOperationExceptionlongadd(long instant, long value) Always throws UnsupportedOperationExceptionintcompareTo(DurationField durationField) Always returns zero, indicating that sort order is not relevant.booleanCompares this duration field to another.intgetDifference(long minuendInstant, long subtrahendInstant) Always throws UnsupportedOperationExceptionlonggetDifferenceAsLong(long minuendInstant, long subtrahendInstant) Always throws UnsupportedOperationExceptionstatic UnsupportedDurationFieldgetInstance(DurationFieldType type) Gets an instance of UnsupportedDurationField for a specific named field.longgetMillis(int value) Always throws UnsupportedOperationExceptionlonggetMillis(int value, long instant) Always throws UnsupportedOperationException as this is not supportedlonggetMillis(long value) Always throws UnsupportedOperationExceptionlonggetMillis(long value, long instant) Always throws UnsupportedOperationExceptiongetName()Get the name of the field.final DurationFieldTypegetType()Get the type of the field.longAlways returns zero.intgetValue(long duration) Always throws UnsupportedOperationExceptionintgetValue(long duration, long instant) Always throws UnsupportedOperationExceptionlonggetValueAsLong(long duration) Always throws UnsupportedOperationExceptionlonggetValueAsLong(long duration, long instant) Always throws UnsupportedOperationExceptioninthashCode()Gets a suitable hashcode.booleanThis field is precise.booleanThis field is not supported.toString()Get a suitable debug string.Methods inherited from class org.joda.time.DurationField
subtract, subtract
-
Method Details
-
getInstance
Gets an instance of UnsupportedDurationField for a specific named field. The returned instance is cached.- Parameters:
type- the type to obtain- Returns:
- the instance
-
getType
Description copied from class:DurationFieldGet the type of the field.- Specified by:
getTypein classDurationField- Returns:
- field type
-
getName
Description copied from class:DurationFieldGet the name of the field.By convention, names are plural.
- Specified by:
getNamein classDurationField- Returns:
- field name
-
isSupported
public boolean isSupported()This field is not supported.- Specified by:
isSupportedin classDurationField- Returns:
- false always
-
isPrecise
public boolean isPrecise()This field is precise.- Specified by:
isPrecisein classDurationField- Returns:
- true always
- See Also:
-
getValue
public int getValue(long duration) Always throws UnsupportedOperationException- Specified by:
getValuein classDurationField- Parameters:
duration- the milliseconds to query, which may be negative- Returns:
- the value of the field, in the units of the field, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getValueAsLong
public long getValueAsLong(long duration) Always throws UnsupportedOperationException- Specified by:
getValueAsLongin classDurationField- Parameters:
duration- the milliseconds to query, which may be negative- Returns:
- the value of the field, in the units of the field, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getValue
public int getValue(long duration, long instant) Always throws UnsupportedOperationException- Specified by:
getValuein classDurationField- Parameters:
duration- the milliseconds to query, which may be negativeinstant- the start instant to calculate relative to- Returns:
- the value of the field, in the units of the field, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getValueAsLong
public long getValueAsLong(long duration, long instant) Always throws UnsupportedOperationException- Specified by:
getValueAsLongin classDurationField- Parameters:
duration- the milliseconds to query, which may be negativeinstant- the start instant to calculate relative to- Returns:
- the value of the field, in the units of the field, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getMillis
public long getMillis(int value) Always throws UnsupportedOperationException- Specified by:
getMillisin classDurationField- Parameters:
value- the value of the field, which may be negative- Returns:
- the milliseconds that the field represents, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getMillis
public long getMillis(long value) Always throws UnsupportedOperationException- Specified by:
getMillisin classDurationField- Parameters:
value- the value of the field, which may be negative- Returns:
- the milliseconds that the field represents, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getMillis
public long getMillis(int value, long instant) Always throws UnsupportedOperationException as this is not supported- Specified by:
getMillisin classDurationField- Parameters:
value- the value of the field, which may be negativeinstant- the instant to calculate relative to- Returns:
- the millisecond duration that the field represents, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
getMillis
public long getMillis(long value, long instant) Always throws UnsupportedOperationException- Specified by:
getMillisin classDurationField- Parameters:
value- the value of the field, which may be negativeinstant- the instant to calculate relative to- Returns:
- the millisecond duration that the field represents, which may be negative
- Throws:
UnsupportedOperationException- as this is not supported
-
add
public long add(long instant, int value) Always throws UnsupportedOperationException- Specified by:
addin classDurationField- 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:
UnsupportedOperationException- as this is not supported
-
add
public long add(long instant, long value) Always throws UnsupportedOperationException- Specified by:
addin classDurationField- 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:
UnsupportedOperationException- as this is not supported
-
getDifference
public int getDifference(long minuendInstant, long subtrahendInstant) Always throws UnsupportedOperationException- Specified by:
getDifferencein classDurationField- 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:
UnsupportedOperationException- as this is not supported
-
getDifferenceAsLong
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) Always throws UnsupportedOperationException- Specified by:
getDifferenceAsLongin classDurationField- 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:
UnsupportedOperationException- as this is not supported
-
getUnitMillis
public long getUnitMillis()Always returns zero.- Specified by:
getUnitMillisin classDurationField- Returns:
- zero always
- See Also:
-
compareTo
Always returns zero, indicating that sort order is not relevant.- Specified by:
compareToin interfaceComparable<DurationField>- Returns:
- zero always
-
equals
Compares this duration field to another. -
hashCode
public int hashCode()Gets a suitable hashcode. -
toString
Get a suitable debug string.- Specified by:
toStringin classDurationField- Returns:
- debug string
-