Class DefaultConversionContext
- java.lang.Object
-
- org.mapstruct.ap.internal.model.common.DefaultConversionContext
-
- All Implemented Interfaces:
ConversionContext
public class DefaultConversionContext extends java.lang.Object implements ConversionContext
Default implementation of theConversionContextpassed to conversion providers.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringdateFormatprivate FormattingParametersformattingParametersprivate FormattingMessagermessagerprivate java.lang.StringnumberFormatprivate TypesourceTypeprivate TypetargetTypeprivate TypeFactorytypeFactory
-
Constructor Summary
Constructors Constructor Description DefaultConversionContext(TypeFactory typeFactory, FormattingMessager messager, Type sourceType, Type targetType, FormattingParameters formattingParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDateFormat()Returns the date format if this conversion or built-in method is from String to a date type (e.g.protected FormattingMessagergetMessager()java.lang.StringgetNumberFormat()TypegetTargetType()Returns the target type of this conversion.TypeFactorygetTypeFactory()private voidvalidateDateFormat()Validate the dateFormat if it is not null
-
-
-
Field Detail
-
messager
private final FormattingMessager messager
-
sourceType
private final Type sourceType
-
targetType
private final Type targetType
-
formattingParameters
private final FormattingParameters formattingParameters
-
dateFormat
private final java.lang.String dateFormat
-
numberFormat
private final java.lang.String numberFormat
-
typeFactory
private final TypeFactory typeFactory
-
-
Constructor Detail
-
DefaultConversionContext
public DefaultConversionContext(TypeFactory typeFactory, FormattingMessager messager, Type sourceType, Type targetType, FormattingParameters formattingParameters)
-
-
Method Detail
-
validateDateFormat
private void validateDateFormat()
Validate the dateFormat if it is not null
-
getTargetType
public Type getTargetType()
Description copied from interface:ConversionContextReturns the target type of this conversion.- Specified by:
getTargetTypein interfaceConversionContext- Returns:
- The target type of this conversion.
-
getNumberFormat
public java.lang.String getNumberFormat()
- Specified by:
getNumberFormatin interfaceConversionContext
-
getDateFormat
public java.lang.String getDateFormat()
Description copied from interface:ConversionContextReturns the date format if this conversion or built-in method is from String to a date type (e.g.Date) or vice versa.- Specified by:
getDateFormatin interfaceConversionContext- Returns:
- The date format if this conversion or built-in method is from String to a date type.
nullis returned for other types or if not given.
-
getTypeFactory
public TypeFactory getTypeFactory()
- Specified by:
getTypeFactoryin interfaceConversionContext
-
getMessager
protected FormattingMessager getMessager()
-
-