Package org.mapstruct
Enum NullValueCheckStrategy
- java.lang.Object
-
- java.lang.Enum<NullValueCheckStrategy>
-
- org.mapstruct.NullValueCheckStrategy
-
- All Implemented Interfaces:
Serializable
,Comparable<NullValueCheckStrategy>
public enum NullValueCheckStrategy extends Enum<NullValueCheckStrategy>
Strategy for dealing with null source values. Note: This strategy is not in effect when a specific source presence check method is defined in the service provider interface (SPI).Note: some types of mappings (collections, maps), in which MapStruct is instructed to use a getter or adder as target accessor see
CollectionMappingStrategy
, MapStruct will always generate a source property null check, regardless the value of theNullValueCheckStrategy
to avoid addition ofnull
to the target collection or map.- Author:
- Sean Huang
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALWAYS
This option always includes a null check.ON_IMPLICIT_CONVERSION
This option includes a null check.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NullValueCheckStrategy
valueOf(String name)
Returns the enum constant of this type with the specified name.static NullValueCheckStrategy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ON_IMPLICIT_CONVERSION
public static final NullValueCheckStrategy ON_IMPLICIT_CONVERSION
This option includes a null check. When:
- a source value is directly assigned to a target
- a source value assigned to a target by calling a type conversion on the target first
NOTE: mapping methods (generated or hand written) are excluded from this null check. They are intended to handle a null source value as 'valid' input.
-
ALWAYS
public static final NullValueCheckStrategy ALWAYS
This option always includes a null check.
-
-
Method Detail
-
values
public static NullValueCheckStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NullValueCheckStrategy c : NullValueCheckStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NullValueCheckStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-