Package org.mapstruct

Enum NullValueMappingStrategy

    • Enum Constant Detail

      • RETURN_NULL

        public static final NullValueMappingStrategy RETURN_NULL
        If null is passed to a mapping method, null will be returned. That's the default behavior if no alternative strategy is configured globally, for given mapper or method.
      • RETURN_DEFAULT

        public static final NullValueMappingStrategy RETURN_DEFAULT
        If null is passed to a mapping method, a default value will be returned. The value depends on the kind of the annotated method:
        • For bean mapping methods the target type will be instantiated and returned. Any properties of the target type which are mapped via Mapping.expression() or Mapping.constant() will be populated based on the given expression or constant. Note that expressions must be prepared to deal with null values in this case.
        • For iterable mapping methods an empty collection will be returned.
        • For map mapping methods an empty map will be returned.
    • Method Detail

      • values

        public static NullValueMappingStrategy[] 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 (NullValueMappingStrategy c : NullValueMappingStrategy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NullValueMappingStrategy 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 name
        NullPointerException - if the argument is null