public abstract class AbstractJavaTimeToStringConversion extends SimpleConversion
Base type for mapping Java 8 time types to String and vice versa.
In general each type comes with a "parse" method to convert a string to this particular type.
For formatting a dedicated instance of DateTimeFormatter
is used.
If no date format for mapping is specified predefined ISO* formatters from
DateTimeFormatter
are used.
An overview of date and time types shipped with Java 8 can be found at http://docs.oracle.com/javase/tutorial/datetime/iso/index.html.
Constructor and Description |
---|
AbstractJavaTimeToStringConversion() |
Modifier and Type | Method and Description |
---|---|
protected abstract String |
defaultFormatterSuffix() |
protected Set<Type> |
getFromConversionImportTypes(ConversionContext conversionContext)
Returns a set with imported types of the "from" conversion.
|
protected String |
getFromExpression(ConversionContext conversionContext)
Returns the conversion string from target to source.
|
protected Set<Type> |
getToConversionImportTypes(ConversionContext conversionContext)
Returns a set with imported types of the "to" conversion.
|
protected String |
getToExpression(ConversionContext conversionContext)
Returns the conversion string from source to target.
|
from, getFromConversionExceptionTypes, getRequiredHelperMethods, getToConversionExceptionTypes, to
protected String getToExpression(ConversionContext conversionContext)
SimpleConversion
<SOURCE>
can be used to represent a
reference to the source value.getToExpression
in class SimpleConversion
conversionContext
- A context providing optional information required for creating the conversion.protected abstract String defaultFormatterSuffix()
protected String getFromExpression(ConversionContext conversionContext)
SimpleConversion
<SOURCE>
can be used to represent a
reference to the target value.getFromExpression
in class SimpleConversion
conversionContext
- ConversionContext providing optional information required for creating the conversion.protected Set<Type> getToConversionImportTypes(ConversionContext conversionContext)
SimpleConversion
getToConversionImportTypes
in class SimpleConversion
conversionContext
- the conversion contextprotected Set<Type> getFromConversionImportTypes(ConversionContext conversionContext)
SimpleConversion
getFromConversionImportTypes
in class SimpleConversion
conversionContext
- the conversion contextCopyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.