Package org.joda.time.convert
Class ReadablePartialConverter
- java.lang.Object
-
- org.joda.time.convert.AbstractConverter
-
- org.joda.time.convert.ReadablePartialConverter
-
- All Implemented Interfaces:
Converter
,PartialConverter
class ReadablePartialConverter extends AbstractConverter implements PartialConverter
ReadablePartialConverter extracts partial fields and chronology from a ReadablePartial.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ReadablePartialConverter
INSTANCE
Singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReadablePartialConverter()
Restricted constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Chronology
getChronology(java.lang.Object object, Chronology chrono)
Gets the chronology, which is taken from the ReadableInstant.Chronology
getChronology(java.lang.Object object, DateTimeZone zone)
Gets the chronology, which is taken from the ReadablePartial.int[]
getPartialValues(ReadablePartial fieldSource, java.lang.Object object, Chronology chrono)
Extracts the values of the partial from an object of this converter's type.java.lang.Class<?>
getSupportedType()
Returns ReadableInstant.class.-
Methods inherited from class org.joda.time.convert.AbstractConverter
getInstantMillis, getPartialValues, getPeriodType, isReadableInterval, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.joda.time.convert.PartialConverter
getPartialValues
-
-
-
-
Field Detail
-
INSTANCE
static final ReadablePartialConverter INSTANCE
Singleton instance.
-
-
Method Detail
-
getChronology
public Chronology getChronology(java.lang.Object object, DateTimeZone zone)
Gets the chronology, which is taken from the ReadablePartial.- Specified by:
getChronology
in interfacePartialConverter
- Overrides:
getChronology
in classAbstractConverter
- Parameters:
object
- the ReadablePartial to convert, must not be nullzone
- the specified zone to use, null means default zone- Returns:
- the chronology, never null
-
getChronology
public Chronology getChronology(java.lang.Object object, Chronology chrono)
Gets the chronology, which is taken from the ReadableInstant.If the passed in chronology is non-null, it is used. Otherwise the chronology from the instant is used.
- Specified by:
getChronology
in interfacePartialConverter
- Overrides:
getChronology
in classAbstractConverter
- Parameters:
object
- the ReadablePartial to convert, must not be nullchrono
- the chronology to use, null means use that from object- Returns:
- the chronology, never null
-
getPartialValues
public int[] getPartialValues(ReadablePartial fieldSource, java.lang.Object object, Chronology chrono)
Extracts the values of the partial from an object of this converter's type. The chrono parameter is a hint to the converter, should it require a chronology to aid in conversion.- Specified by:
getPartialValues
in interfacePartialConverter
- Overrides:
getPartialValues
in classAbstractConverter
- Parameters:
fieldSource
- a partial that provides access to the fields. This partial may be incomplete and only getFieldType(int) should be usedobject
- the object to convertchrono
- the chronology to use, which is the non-null result of getChronology()- Returns:
- the array of field values that match the fieldSource, must be non-null valid
- Throws:
java.lang.ClassCastException
- if the object is invalid
-
getSupportedType
public java.lang.Class<?> getSupportedType()
Returns ReadableInstant.class.- Specified by:
getSupportedType
in interfaceConverter
- Returns:
- ReadableInstant.class
-
-