org.joda.time.field

Class DelegatedDurationField

Implemented Interfaces:
Comparable, Serializable

public class DelegatedDurationField
extends DurationField
implements Serializable

DelegatedDurationField delegates each method call to the duration field it wraps.

DelegatedDurationField is thread-safe and immutable, and its subclasses must be as well.

Author:
Brian S O'Neill
Since:
1.0
See Also:
DecoratedDurationField

Constructor Summary

DelegatedDurationField(DurationField field)
Constructor.
DelegatedDurationField(DurationField field, DurationFieldType type)
Constructor.

Method Summary

long
add(long instant, int value)
long
add(long instant, long value)
int
compareTo(Object durationField)
int
getDifference(long minuendInstant, long subtrahendInstant)
long
getDifferenceAsLong(long minuendInstant, long subtrahendInstant)
long
getMillis(int value)
long
getMillis(int value, long instant)
long
getMillis(long value)
long
getMillis(long value, long instant)
String
getName()
DurationFieldType
getType()
long
getUnitMillis()
int
getValue(long duration)
int
getValue(long duration, long instant)
long
getValueAsLong(long duration)
long
getValueAsLong(long duration, long instant)
DurationField
getWrappedField()
Gets the wrapped duration field.
boolean
isPrecise()
boolean
isSupported()
Returns true if this field is supported.
String
toString()

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

Constructor Details

DelegatedDurationField

protected DelegatedDurationField(DurationField field)
Constructor.
Parameters:
field - the base field

DelegatedDurationField

protected DelegatedDurationField(DurationField field,
                                 DurationFieldType type)
Constructor.
Parameters:
field - the base field
type - the field type to use

Method Details

add

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

add

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

compareTo

public int compareTo(Object durationField)
Overrides:
compareTo in interface DurationField

getDifference

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

getDifferenceAsLong

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

getMillis

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

getMillis

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

getMillis

public long getMillis(long value)
Overrides:
getMillis in interface DurationField

getMillis

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

getName

public String getName()
Overrides:
getName in interface DurationField

getType

public DurationFieldType getType()
Overrides:
getType in interface DurationField

getUnitMillis

public long getUnitMillis()
Overrides:
getUnitMillis in interface DurationField

getValue

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

getValue

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

getValueAsLong

public long getValueAsLong(long duration)
Overrides:
getValueAsLong in interface DurationField

getValueAsLong

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

getWrappedField

public final DurationField getWrappedField()
Gets the wrapped duration field.
Returns:
the wrapped DurationField

isPrecise

public boolean isPrecise()
Overrides:
isPrecise in interface DurationField

isSupported

public boolean isSupported()
Returns true if this field is supported.
Overrides:
isSupported in interface DurationField

toString

public String toString()
Overrides:
toString in interface DurationField

Copyright (c) 2001-2006 - Joda.org