|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.time.convert.AbstractConverter
public abstract class AbstractConverter
AbstractConverter simplifies the process of implementing a converter.
Constructor Summary | |
---|---|
protected |
AbstractConverter()
Restricted constructor. |
Method Summary | |
---|---|
Chronology |
getChronology(Object object,
Chronology chrono)
Extracts the chronology from an object of this convertor's type where the chronology is specified. |
Chronology |
getChronology(Object object,
DateTimeZone zone)
Extracts the chronology from an object of this convertor's type where the time zone is specified. |
long |
getInstantMillis(Object object,
Chronology chrono)
Extracts the millis from an object of this convertor's type. |
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. |
PeriodType |
getPeriodType(Object object)
Selects a suitable period type for the given object. |
boolean |
isReadableInterval(Object object,
Chronology chrono)
Checks if the input is a ReadableInterval. |
String |
toString()
Gets a debugging string version of this converter. |
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.Converter |
---|
getSupportedType |
Constructor Detail |
---|
protected AbstractConverter()
Method Detail |
---|
public long getInstantMillis(Object object, Chronology chrono)
This implementation returns the current time.
object
- the object to convertchrono
- the chronology to use, which is always non-null
public Chronology getChronology(Object object, DateTimeZone zone)
This implementation returns the ISO chronology.
object
- the object to convertzone
- the specified zone to use, null means default zone
public Chronology getChronology(Object object, Chronology chrono)
This implementation returns the chronology specified, or the ISO chronology in the default zone if null passed in.
object
- the object to convertchrono
- the chronology to use, null means ISO default
public int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono)
This implementation calls getInstantMillis(Object, Chronology)
.
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()
ClassCastException
- if the object is invalidpublic int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono, DateTimeFormatter parser)
This implementation calls getPartialValues(ReadablePartial, Object, Chronology)
.
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()parser
- if converting from a String, the given parser is preferred
ClassCastException
- if the object is invalidpublic PeriodType getPeriodType(Object object)
object
- the object to examine
public boolean isReadableInterval(Object object, Chronology chrono)
If it is, then the calling code should cast and copy the fields directly.
object
- the object to convertchrono
- the chronology to use, may be null
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |