Enum Value.Style.ValidationMethod

java.lang.Object
java.lang.Enum<Value.Style.ValidationMethod>
org.immutables.value.Value.Style.ValidationMethod
All Implemented Interfaces:
Serializable, Comparable<Value.Style.ValidationMethod>, java.lang.constant.Constable
Enclosing class:
Value.Style

public static enum Value.Style.ValidationMethod extends Enum<Value.Style.ValidationMethod>
  • Enum Constant Details

    • NONE

      public static final Value.Style.ValidationMethod NONE
      Disables null and mandatory attribute checks. Any missing primitives will be initialized to their zero-based values: false, 0, '\0'. Object references will be nulls. Any optional, default and collection attributes will be initialized with their appropriate default values regardless of this validation setting.
    • MANDATORY_ONLY

      public static final Value.Style.ValidationMethod MANDATORY_ONLY
      This validation method is similar to NONE in that that there are no null checks. But all attributes which are not `@Default` or marked with `@Nullable` are still checked to be provided (even with null values in case of object references.
    • SIMPLE

      public static final Value.Style.ValidationMethod SIMPLE
      Simple validation, verifying that non-null attributes have been provided. This is classic fail-fast, null-hostile behavior and works best in most cases.
    • VALIDATION_API

      public static final Value.Style.ValidationMethod VALIDATION_API
      Validation using Java Bean Validation API (JSR 303). It disables null checks, in favor or @javax.validation.constraints.NotNull and creates static validator per objects. To better control the usage of JSR 303 Validator objects or enable fail-fast null checks, please use custom validation mixin approach, where you create base abstract class or interface with default methods to provide `@Value.Check` which would explicitly call validation of your choice. Please see discussion and examples provided in the following github issue: immutables/immutables#26
  • Constructor Details

    • ValidationMethod

      private ValidationMethod()
  • Method Details

    • values

      public static Value.Style.ValidationMethod[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Value.Style.ValidationMethod 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