public class DefaultEnumMappingStrategy extends Object implements EnumMappingStrategy
Modifier and Type | Field and Description |
---|---|
protected Elements |
elementUtils |
protected Types |
typeUtils |
Constructor and Description |
---|
DefaultEnumMappingStrategy() |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultNullEnumConstant(TypeElement enumType)
Return the default enum constant to use if the source is null.
|
String |
getEnumConstant(TypeElement enumType,
String enumConstant)
Map the enum constant to the value use for matching.
|
protected Class<? extends Exception> |
getUnexpectedValueMappingExceptionClass() |
TypeElement |
getUnexpectedValueMappingExceptionType()
Return the type element of the exception that should be used in the generated code
for an unexpected enum constant.
|
void |
init(MapStructProcessingEnvironment processingEnvironment)
Initializes the enum value mapping strategy
|
public void init(MapStructProcessingEnvironment processingEnvironment)
EnumMappingStrategy
init
in interface EnumMappingStrategy
processingEnvironment
- environment for facilitiespublic String getDefaultNullEnumConstant(TypeElement enumType)
EnumMappingStrategy
getDefaultNullEnumConstant
in interface EnumMappingStrategy
enumType
- the enumpublic String getEnumConstant(TypeElement enumType, String enumConstant)
EnumMappingStrategy
MappingConstants.NULL
getEnumConstant
in interface EnumMappingStrategy
enumType
- the enum this constant belongs toenumConstant
- constant to transformpublic TypeElement getUnexpectedValueMappingExceptionType()
EnumMappingStrategy
getUnexpectedValueMappingExceptionType
in interface EnumMappingStrategy
null
Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.