Class AbstractJavaTimeToStringConversion
- java.lang.Object
-
- org.mapstruct.ap.internal.conversion.SimpleConversion
-
- org.mapstruct.ap.internal.conversion.AbstractJavaTimeToStringConversion
-
- All Implemented Interfaces:
ConversionProvider
- Direct Known Subclasses:
JavaLocalDateTimeToStringConversion,JavaLocalDateToStringConversion,JavaLocalTimeToStringConversion,JavaZonedDateTimeToStringConversion
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
DateTimeFormatteris used.If no date format for mapping is specified predefined ISO* formatters from
DateTimeFormatterare used.An overview of date and time types shipped with Java 8 can be found at the Standard Calendar Tutorial
-
-
Constructor Summary
Constructors Constructor Description AbstractJavaTimeToStringConversion()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract StringdefaultFormatterSuffix()protected Set<Type>getFromConversionImportTypes(ConversionContext conversionContext)Returns a set with imported types of the "from" conversion.protected StringgetFromExpression(ConversionContext conversionContext)Returns the conversion string from target to source.List<FieldReference>getRequiredHelperFields(ConversionContext conversionContext)protected Set<Type>getToConversionImportTypes(ConversionContext conversionContext)Returns a set with imported types of the "to" conversion.protected StringgetToExpression(ConversionContext conversionContext)Returns the conversion string from source to target.-
Methods inherited from class org.mapstruct.ap.internal.conversion.SimpleConversion
from, getFromConversionExceptionTypes, getRequiredHelperMethods, getToConversionExceptionTypes, to
-
-
-
-
Method Detail
-
getToExpression
protected String getToExpression(ConversionContext conversionContext)
Description copied from class:SimpleConversionReturns the conversion string from source to target. The placeholder<SOURCE>can be used to represent a reference to the source value.- Specified by:
getToExpressionin classSimpleConversion- Parameters:
conversionContext- A context providing optional information required for creating the conversion.- Returns:
- The conversion string from source to target
-
defaultFormatterSuffix
protected abstract String defaultFormatterSuffix()
-
getFromExpression
protected String getFromExpression(ConversionContext conversionContext)
Description copied from class:SimpleConversionReturns the conversion string from target to source. The placeholder<SOURCE>can be used to represent a reference to the target value.- Specified by:
getFromExpressionin classSimpleConversion- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- The conversion string from target to source
-
getToConversionImportTypes
protected Set<Type> getToConversionImportTypes(ConversionContext conversionContext)
Description copied from class:SimpleConversionReturns a set with imported types of the "to" conversion. Defaults to an empty set; can be overridden in sub-classes to return the required types.- Overrides:
getToConversionImportTypesin classSimpleConversion- Parameters:
conversionContext- the conversion context- Returns:
- conversion types required in the "to" conversion
-
getFromConversionImportTypes
protected Set<Type> getFromConversionImportTypes(ConversionContext conversionContext)
Description copied from class:SimpleConversionReturns a set with imported types of the "from" conversion. Defaults to an empty set; can be overridden in sub-classes to return the required types.- Overrides:
getFromConversionImportTypesin classSimpleConversion- Parameters:
conversionContext- the conversion context- Returns:
- conversion types required in the "from" conversion
-
getRequiredHelperFields
public List<FieldReference> getRequiredHelperFields(ConversionContext conversionContext)
- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- any fields when required.
-
-