Package no.entur.mapstruct.spi.protobuf
Class ProtobufEnumMappingStrategy
- java.lang.Object
-
- org.mapstruct.ap.spi.DefaultEnumMappingStrategy
-
- no.entur.mapstruct.spi.protobuf.ProtobufEnumMappingStrategy
-
- All Implemented Interfaces:
org.mapstruct.ap.spi.EnumMappingStrategy
public class ProtobufEnumMappingStrategy extends org.mapstruct.ap.spi.DefaultEnumMappingStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDEFAULT_ENUM_CONSTANT
-
Constructor Summary
Constructors Constructor Description ProtobufEnumMappingStrategy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static StringgetDefaultEnumConstant()The enum constant postfix used as default value in protobuf, ie for enum "Cake" the default constant should be CAKE_UNSPECIFIED = 0; This is the recommended style according to Googles style guide https://developers.google.com/protocol-buffers/docs/style#enums .StringgetDefaultNullEnumConstant(TypeElement enumType)StringgetEnumConstant(TypeElement enumType, String sourceEnumValue)booleanisMapEnumConstantToNull(TypeElement enumType, String sourceEnumValue)
-
-
-
Field Detail
-
DEFAULT_ENUM_CONSTANT
protected static final String DEFAULT_ENUM_CONSTANT
-
-
Method Detail
-
getDefaultEnumConstant
protected static String getDefaultEnumConstant()
The enum constant postfix used as default value in protobuf, ie for enum "Cake" the default constant should be CAKE_UNSPECIFIED = 0; This is the recommended style according to Googles style guide https://developers.google.com/protocol-buffers/docs/style#enums . If you use some other pattern in your protobuf files you can simply subclass this class and override this method.
-
isMapEnumConstantToNull
public boolean isMapEnumConstantToNull(TypeElement enumType, String sourceEnumValue)
-
getDefaultNullEnumConstant
public String getDefaultNullEnumConstant(TypeElement enumType)
- Specified by:
getDefaultNullEnumConstantin interfaceorg.mapstruct.ap.spi.EnumMappingStrategy- Overrides:
getDefaultNullEnumConstantin classorg.mapstruct.ap.spi.DefaultEnumMappingStrategy
-
getEnumConstant
public String getEnumConstant(TypeElement enumType, String sourceEnumValue)
- Specified by:
getEnumConstantin interfaceorg.mapstruct.ap.spi.EnumMappingStrategy- Overrides:
getEnumConstantin classorg.mapstruct.ap.spi.DefaultEnumMappingStrategy
-
-