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
ReadablePartialConverter extracts partial fields and chronology from a ReadablePartial.
- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ReadablePartialConverterSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChronology(Object object, Chronology chrono) Gets the chronology, which is taken from the ReadableInstant.getChronology(Object object, DateTimeZone zone) Gets the chronology, which is taken from the ReadablePartial.int[]getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono) Extracts the values of the partial from an object of this converter's type.Class<?> Returns ReadableInstant.class.Methods inherited from class org.joda.time.convert.AbstractConverter
getInstantMillis, getPartialValues, getPeriodType, isReadableInterval, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.joda.time.convert.PartialConverter
getPartialValues
-
Field Details
-
INSTANCE
Singleton instance.
-
-
Constructor Details
-
ReadablePartialConverter
protected ReadablePartialConverter()Restricted constructor.
-
-
Method Details
-
getChronology
Gets the chronology, which is taken from the ReadablePartial.- Specified by:
getChronologyin interfacePartialConverter- Overrides:
getChronologyin 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
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:
getChronologyin interfacePartialConverter- Overrides:
getChronologyin 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
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:
getPartialValuesin interfacePartialConverter- Overrides:
getPartialValuesin 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:
ClassCastException- if the object is invalid
-
getSupportedType
Returns ReadableInstant.class.- Specified by:
getSupportedTypein interfaceConverter- Returns:
- ReadableInstant.class
-