public abstract class AbstractConverter extends java.lang.Object implements Converter
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
dateFormat |
protected java.text.SimpleDateFormat |
dateFormatter |
protected java.lang.String |
localDateFormat |
protected java.lang.String |
localDateTimeFormat |
protected java.lang.String |
localTimeFormat |
protected static java.util.Map<java.lang.String,java.lang.Class<?>> |
primitives |
protected java.text.SimpleDateFormat |
sqlDateFormatter |
protected java.lang.String |
timeFormat |
protected java.text.SimpleDateFormat |
timeFormatter |
protected java.lang.String |
timestampFormat |
protected java.text.SimpleDateFormat |
timestampFormatter |
protected java.lang.String |
zoneId |
| Constructor and Description |
|---|
AbstractConverter() |
| Modifier and Type | Method and Description |
|---|---|
<I,O> O |
convert(I input,
java.lang.Class<O> outputClass) |
<I,O> O |
convert(I input,
java.lang.String outputClassName) |
<I> java.lang.String |
convertEnum(I input) |
<I,O> O |
convertPrimitive(I input,
java.lang.Class<O> outputClass) |
<I,O> O |
convertTemporal(I input,
java.lang.Class<O> outputClass)
While converting temporal values some precision is lost (like
java.time.LocalTime to java.sql.Time).
|
java.lang.String |
getDateFormat() |
java.lang.String |
getLocalDateFormat() |
java.lang.String |
getLocalDateTimeFormat() |
java.lang.String |
getLocalTimeFormat() |
java.lang.String |
getSqlDateFormat(java.lang.String sqlDateFormat) |
java.lang.String |
getTimeFormat() |
java.lang.String |
getTimestampFormat() |
java.lang.String |
getZoneId() |
protected boolean |
isPrimitive(java.lang.String className) |
void |
setDateFormat(java.lang.String dateFormat) |
void |
setLocalDateFormat(java.lang.String localDateFormat) |
void |
setLocalDateTimeFormat(java.lang.String localDateTimeFormat) |
void |
setLocalTimeFormat(java.lang.String localTimeFormat) |
void |
setSqlDateFormat(java.lang.String sqlDateFormat) |
void |
setTimeFormat(java.lang.String timeFormat) |
void |
setTimestampFormat(java.lang.String timestampFormat) |
void |
setZoneId(java.lang.String zoneId) |
boolean |
toBoolean(java.lang.String value)
Case insensitive: "0", "false", "n", "no", "off" = false; "1", "y", "yes", "on", "true" = true
|
<I,O> O |
toEnum(I input,
java.lang.Class<O> outputClassName) |
protected <I> java.time.Instant |
toInstant(I input) |
<I> java.time.LocalDate |
toLocalDate(I input) |
protected <I> java.time.LocalDateTime |
toLocalDateTime(I input) |
protected <I> java.time.LocalTime |
toLocalTime(I input) |
protected <I> java.time.OffsetDateTime |
toOffsetDateTime(I input) |
protected <I> java.time.OffsetTime |
toOffsetTime(I input) |
protected <I> java.sql.Date |
toSqlDate(I input) |
protected <I> java.sql.Time |
toSqlTime(I input) |
protected <I> java.sql.Timestamp |
toTimestamp(I input) |
protected <I> java.util.Date |
toUtilDate(I input) |
protected <I> java.time.ZonedDateTime |
toZonedDateTime(I input) |
protected java.lang.String dateFormat
protected java.lang.String timestampFormat
protected java.lang.String timeFormat
protected java.lang.String localDateFormat
protected java.lang.String localDateTimeFormat
protected java.lang.String localTimeFormat
protected java.text.SimpleDateFormat dateFormatter
protected java.text.SimpleDateFormat timestampFormatter
protected java.text.SimpleDateFormat timeFormatter
protected java.text.SimpleDateFormat sqlDateFormatter
protected java.lang.String zoneId
protected static final java.util.Map<java.lang.String,java.lang.Class<?>> primitives
public java.lang.String getDateFormat()
getDateFormat in interface Converterpublic void setDateFormat(java.lang.String dateFormat)
setDateFormat in interface Converterpublic java.lang.String getTimestampFormat()
getTimestampFormat in interface Converterpublic void setTimestampFormat(java.lang.String timestampFormat)
setTimestampFormat in interface Converterpublic java.lang.String getTimeFormat()
getTimeFormat in interface Converterpublic void setTimeFormat(java.lang.String timeFormat)
setTimeFormat in interface Converterpublic java.lang.String getSqlDateFormat(java.lang.String sqlDateFormat)
getSqlDateFormat in interface Converterpublic void setSqlDateFormat(java.lang.String sqlDateFormat)
setSqlDateFormat in interface Converterpublic java.lang.String getLocalDateFormat()
getLocalDateFormat in interface Converterpublic void setLocalDateFormat(java.lang.String localDateFormat)
setLocalDateFormat in interface Converterpublic java.lang.String getLocalDateTimeFormat()
getLocalDateTimeFormat in interface Converterpublic void setLocalDateTimeFormat(java.lang.String localDateTimeFormat)
setLocalDateTimeFormat in interface Converterpublic java.lang.String getLocalTimeFormat()
getLocalTimeFormat in interface Converterpublic void setLocalTimeFormat(java.lang.String localTimeFormat)
setLocalTimeFormat in interface Converterpublic void setZoneId(java.lang.String zoneId)
public <I,O> O toEnum(I input,
java.lang.Class<O> outputClassName)
throws DataAccessException
DataAccessExceptionpublic <I> java.lang.String convertEnum(I input)
throws DataAccessException
DataAccessExceptionpublic <I,O> O convert(I input,
java.lang.String outputClassName)
throws DataAccessException
convert in interface ConverterDataAccessExceptionpublic <I,O> O convert(I input,
java.lang.Class<O> outputClass)
throws DataAccessException
convert in interface ConverterDataAccessExceptionprotected boolean isPrimitive(java.lang.String className)
public <I,O> O convertPrimitive(I input,
java.lang.Class<O> outputClass)
throws DataAccessException
convertPrimitive in interface ConverterDataAccessExceptionpublic <I> java.time.LocalDate toLocalDate(I input)
protected <I> java.time.OffsetTime toOffsetTime(I input)
protected <I> java.time.OffsetDateTime toOffsetDateTime(I input)
protected <I> java.time.ZonedDateTime toZonedDateTime(I input)
protected <I> java.time.LocalDateTime toLocalDateTime(I input)
protected <I> java.time.LocalTime toLocalTime(I input)
protected <I> java.time.Instant toInstant(I input)
protected <I> java.sql.Timestamp toTimestamp(I input)
protected <I> java.sql.Date toSqlDate(I input)
protected <I> java.sql.Time toSqlTime(I input)
protected <I> java.util.Date toUtilDate(I input)
public <I,O> O convertTemporal(I input,
java.lang.Class<O> outputClass)
convertTemporal in interface Converter