org.joda.time.field

Class UnsupportedDurationField

Implemented Interfaces:
Comparable, Serializable

public final class UnsupportedDurationField
extends DurationField
implements Serializable

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

UnsupportedDurationField is thread-safe and immutable.

Author:
Brian S O'Neill
Since:
1.0

Method Summary

long
add(long instant, int value)
Always throws UnsupportedOperationException
long
add(long instant, long value)
Always throws UnsupportedOperationException
int
compareTo(Object durationField)
Always returns zero, indicating that sort order is not relevent.
boolean
equals(Object obj)
Compares this duration field to another.
int
getDifference(long minuendInstant, long subtrahendInstant)
Always throws UnsupportedOperationException
long
getDifferenceAsLong(long minuendInstant, long subtrahendInstant)
Always throws UnsupportedOperationException
static UnsupportedDurationField
getInstance(DurationFieldType type)
Gets an instance of UnsupportedDurationField for a specific named field.
long
getMillis(int value)
Always throws UnsupportedOperationException
long
getMillis(int value, long instant)
Always throws UnsupportedOperationException
long
getMillis(long value)
Always throws UnsupportedOperationException
long
getMillis(long value, long instant)
Always throws UnsupportedOperationException
String
getName()
DurationFieldType
getType()
long
getUnitMillis()
Always returns zero.
int
getValue(long duration)
Always throws UnsupportedOperationException
int
getValue(long duration, long instant)
Always throws UnsupportedOperationException
long
getValueAsLong(long duration)
Always throws UnsupportedOperationException
long
getValueAsLong(long duration, long instant)
Always throws UnsupportedOperationException
int
hashCode()
Gets a suitable hashcode.
boolean
isPrecise()
This field is precise.
boolean
isSupported()
This field is not supported.
String
toString()
Get a suitable debug string.

Methods inherited from class org.joda.time.DurationField

add, add, compareTo, getDifference, getDifferenceAsLong, getMillis, getMillis, getMillis, getMillis, getName, getType, getUnitMillis, getValue, getValue, getValueAsLong, getValueAsLong, isPrecise, isSupported, subtract, subtract, toString

Method Details

add

public long add(long instant,
                int value)
Always throws UnsupportedOperationException
Overrides:
add in interface DurationField

add

public long add(long instant,
                long value)
Always throws UnsupportedOperationException
Overrides:
add in interface DurationField

compareTo

public int compareTo(Object durationField)
Always returns zero, indicating that sort order is not relevent.
Overrides:
compareTo in interface DurationField
Returns:
zero always

equals

public boolean equals(Object obj)
Compares this duration field to another.
Parameters:
obj - the object to compare to
Returns:
true if equal

getDifference

public int getDifference(long minuendInstant,
                         long subtrahendInstant)
Always throws UnsupportedOperationException
Overrides:
getDifference in interface DurationField

getDifferenceAsLong

public long getDifferenceAsLong(long minuendInstant,
                                long subtrahendInstant)
Always throws UnsupportedOperationException
Overrides:
getDifferenceAsLong in interface DurationField

getInstance

public static UnsupportedDurationField getInstance(DurationFieldType type)
Gets an instance of UnsupportedDurationField for a specific named field. The returned instance is cached.
Parameters:
type - the type to obtain
Returns:
the instance

getMillis

public long getMillis(int value)
Always throws UnsupportedOperationException
Overrides:
getMillis in interface DurationField

getMillis

public long getMillis(int value,
                      long instant)
Always throws UnsupportedOperationException
Overrides:
getMillis in interface DurationField

getMillis

public long getMillis(long value)
Always throws UnsupportedOperationException
Overrides:
getMillis in interface DurationField

getMillis

public long getMillis(long value,
                      long instant)
Always throws UnsupportedOperationException
Overrides:
getMillis in interface DurationField

getName

public String getName()
Overrides:
getName in interface DurationField

getType

public final DurationFieldType getType()
Overrides:
getType in interface DurationField

getUnitMillis

public long getUnitMillis()
Always returns zero.
Overrides:
getUnitMillis in interface DurationField
Returns:
zero always

getValue

public int getValue(long duration)
Always throws UnsupportedOperationException
Overrides:
getValue in interface DurationField

getValue

public int getValue(long duration,
                    long instant)
Always throws UnsupportedOperationException
Overrides:
getValue in interface DurationField

getValueAsLong

public long getValueAsLong(long duration)
Always throws UnsupportedOperationException
Overrides:
getValueAsLong in interface DurationField

getValueAsLong

public long getValueAsLong(long duration,
                           long instant)
Always throws UnsupportedOperationException
Overrides:
getValueAsLong in interface DurationField

hashCode

public int hashCode()
Gets a suitable hashcode.
Returns:
the hashcode

isPrecise

public boolean isPrecise()
This field is precise.
Overrides:
isPrecise in interface DurationField
Returns:
true always

isSupported

public boolean isSupported()
This field is not supported.
Overrides:
isSupported in interface DurationField
Returns:
false always

toString

public String toString()
Get a suitable debug string.
Overrides:
toString in interface DurationField
Returns:
debug string

Copyright (c) 2001-2006 - Joda.org