Class SimpleConversion
- java.lang.Object
-
- org.mapstruct.ap.internal.conversion.SimpleConversion
-
- All Implemented Interfaces:
ConversionProvider
- Direct Known Subclasses:
AbstractJavaTimeToStringConversion,AbstractJodaTypeToStringConversion,AbstractNumberToStringConversion,BigDecimalToBigIntegerConversion,BigDecimalToPrimitiveConversion,BigDecimalToWrapperConversion,BigIntegerToPrimitiveConversion,BigIntegerToWrapperConversion,CharToStringConversion,CharWrapperToStringConversion,CurrencyToStringConversion,DateToSqlDateConversion,DateToSqlTimeConversion,DateToSqlTimestampConversion,EnumStringConversion,EnumToIntegerConversion,JavaInstantToDateConversion,JavaLocalDateTimeToDateConversion,JavaLocalDateTimeToLocalDateConversion,JavaLocalDateToDateConversion,JavaLocalDateToSqlDateConversion,JavaZonedDateTimeToDateConversion,JodaDateTimeToCalendarConversion,JodaTimeToDateConversion,LocaleToStringConversion,PrimitiveToPrimitiveConversion,PrimitiveToWrapperConversion,StaticParseToStringConversion,StringBuilderToStringConversion,URLToStringConversion,UUIDToStringConversion,WrapperToWrapperConversion
public abstract class SimpleConversion extends Object implements ConversionProvider
Base class forConversionProviders creatingTypeConversions which don't declare any exception types.- Author:
- Gunnar Morling
-
-
Constructor Summary
Constructors Constructor Description SimpleConversion()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Assignmentfrom(ConversionContext conversionContext)Creates the conversion from target to source of a property mapping.protected List<Type>getFromConversionExceptionTypes(ConversionContext conversionContext)protected Set<Type>getFromConversionImportTypes(ConversionContext conversionContext)Returns a set with imported types of the "from" conversion.protected abstract StringgetFromExpression(ConversionContext conversionContext)Returns the conversion string from target to source.List<HelperMethod>getRequiredHelperMethods(ConversionContext conversionContext)protected List<Type>getToConversionExceptionTypes(ConversionContext conversionContext)protected Set<Type>getToConversionImportTypes(ConversionContext conversionContext)Returns a set with imported types of the "to" conversion.protected abstract StringgetToExpression(ConversionContext conversionContext)Returns the conversion string from source to target.Assignmentto(ConversionContext conversionContext)Creates the conversion from source to target of a property mapping.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mapstruct.ap.internal.conversion.ConversionProvider
getRequiredHelperFields
-
-
-
-
Method Detail
-
to
public Assignment to(ConversionContext conversionContext)
Description copied from interface:ConversionProviderCreates the conversion from source to target of a property mapping.- Specified by:
toin interfaceConversionProvider- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- A conversion from source to target.
-
from
public Assignment from(ConversionContext conversionContext)
Description copied from interface:ConversionProviderCreates the conversion from target to source of a property mapping.- Specified by:
fromin interfaceConversionProvider- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- A conversion from target to source.
-
getRequiredHelperMethods
public List<HelperMethod> getRequiredHelperMethods(ConversionContext conversionContext)
- Specified by:
getRequiredHelperMethodsin interfaceConversionProvider- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- any helper methods when required.
-
getToExpression
protected abstract String getToExpression(ConversionContext conversionContext)
Returns the conversion string from source to target. The placeholder<SOURCE>can be used to represent a reference to the source value.- Parameters:
conversionContext- A context providing optional information required for creating the conversion.- Returns:
- The conversion string from source to target
-
getFromExpression
protected abstract String getFromExpression(ConversionContext conversionContext)
Returns the conversion string from target to source. The placeholder<SOURCE>can be used to represent a reference to the target value.- Parameters:
conversionContext- ConversionContext providing optional information required for creating the conversion.- Returns:
- The conversion string from target to source
-
getFromConversionImportTypes
protected Set<Type> getFromConversionImportTypes(ConversionContext conversionContext)
Returns 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.- Parameters:
conversionContext- the conversion context- Returns:
- conversion types required in the "from" conversion
-
getToConversionImportTypes
protected Set<Type> getToConversionImportTypes(ConversionContext conversionContext)
Returns 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.- Parameters:
conversionContext- the conversion context- Returns:
- conversion types required in the "to" conversion
-
getToConversionExceptionTypes
protected List<Type> getToConversionExceptionTypes(ConversionContext conversionContext)
-
getFromConversionExceptionTypes
protected List<Type> getFromConversionExceptionTypes(ConversionContext conversionContext)
-
-