org.joda.time.convert

Interface PartialConverter

All Superinterfaces:
Converter

public interface PartialConverter
extends Converter

PartialConverter defines how an object is converted to a ReadablePartial.

The two methods in this interface must be called in order, as the getPartialValues method relies on the result of the getChronology method being passed in.

Author:
Stephen Colebourne
Since:
1.0

Method Summary

Chronology
getChronology(Object object, Chronology chrono)
Extracts the chronology from an object of this converter's type where the chronology is specified.
Chronology
getChronology(Object object, DateTimeZone zone)
Extracts the chronology from an object of this converter's type where the time zone is specified.
int[]
getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono)
Extracts the values of the partial from an object of this converter's type.
int[]
getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser)
Extracts the values of the partial from an object of this converter's type.

Methods inherited from interface org.joda.time.convert.Converter

getSupportedType

Method Details

getChronology

public Chronology getChronology(Object object,
                                Chronology chrono)
Extracts the chronology from an object of this converter's type where the chronology is specified.
Parameters:
object - the object to convert
chrono - the chronology to use, null usually means ISO
Returns:
the chronology, not converted to UTC/local time zone, must be non-null valid

getChronology

public Chronology getChronology(Object object,
                                DateTimeZone zone)
Extracts the chronology from an object of this converter's type where the time zone is specified.
Parameters:
object - the object to convert
zone - the specified zone to use, null means default zone
Returns:
the chronology, never null
Since:
1.3

getPartialValues

public int[] getPartialValues(ReadablePartial fieldSource,
                              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.
Parameters:
fieldSource - a partial that provides access to the fields. This partial may be incomplete and only getFieldType(int) should be used
object - the object to convert
chrono - 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

getPartialValues

public int[] getPartialValues(ReadablePartial fieldSource,
                              Object object,
                              Chronology chrono,
                              DateTimeFormatter parser)
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.
Parameters:
fieldSource - a partial that provides access to the fields. This partial may be incomplete and only getFieldType(int) should be used
object - the object to convert
chrono - the chronology to use, which is the non-null result of getChronology()
parser - if converting from a String, the given parser is preferred
Returns:
the array of field values that match the fieldSource, must be non-null valid
Since:
1.3

Copyright (c) 2001-2006 - Joda.org