class StringConverter extends AbstractConverter implements InstantConverter, PartialConverter, DurationConverter, PeriodConverter, IntervalConverter
Modifier and Type | Field and Description |
---|---|
(package private) static StringConverter |
INSTANCE
Singleton instance.
|
Modifier | Constructor and Description |
---|---|
protected |
StringConverter()
Restricted constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
getDurationMillis(java.lang.Object object)
Gets the duration of the string using the standard type.
|
long |
getInstantMillis(java.lang.Object object,
Chronology chrono)
Gets the millis, which is the ISO parsed string value.
|
int[] |
getPartialValues(ReadablePartial fieldSource,
java.lang.Object object,
Chronology chrono,
DateTimeFormatter parser)
Extracts the values of the partial from an object of this converter's type.
|
java.lang.Class<?> |
getSupportedType()
Returns String.class.
|
void |
setInto(ReadWritableInterval writableInterval,
java.lang.Object object,
Chronology chrono)
Sets the value of the mutable interval from the string.
|
void |
setInto(ReadWritablePeriod period,
java.lang.Object object,
Chronology chrono)
Extracts duration values from an object of this converter's type, and
sets them into the given ReadWritableDuration.
|
getChronology, getChronology, getPartialValues, getPeriodType, isReadableInterval, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChronology, getChronology
getChronology, getChronology, getPartialValues
getPeriodType
isReadableInterval
static final StringConverter INSTANCE
public long getInstantMillis(java.lang.Object object, Chronology chrono)
getInstantMillis
in interface InstantConverter
getInstantMillis
in class AbstractConverter
object
- the String to convert, must not be nullchrono
- the chronology to use, non-null result of getChronologyjava.lang.IllegalArgumentException
- if the value if invalidpublic int[] getPartialValues(ReadablePartial fieldSource, java.lang.Object object, Chronology chrono, DateTimeFormatter parser)
getPartialValues
in interface PartialConverter
getPartialValues
in class AbstractConverter
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
- the parser to use, may be nulljava.lang.ClassCastException
- if the object is invalidjava.lang.IllegalArgumentException
- if the value if invalidpublic long getDurationMillis(java.lang.Object object)
getDurationMillis
in interface DurationConverter
object
- the String to convert, must not be nulljava.lang.ClassCastException
- if the object is invalidpublic void setInto(ReadWritablePeriod period, java.lang.Object object, Chronology chrono)
setInto
in interface PeriodConverter
period
- period to get modifiedobject
- the String to convert, must not be nullchrono
- the chronology to usejava.lang.ClassCastException
- if the object is invalidpublic void setInto(ReadWritableInterval writableInterval, java.lang.Object object, Chronology chrono)
setInto
in interface IntervalConverter
writableInterval
- the interval to setobject
- the String to convert, must not be nullchrono
- the chronology to use, may be nullpublic java.lang.Class<?> getSupportedType()
getSupportedType
in interface Converter