Enum Value.Style.ValidationMethod

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      MANDATORY_ONLY
      This validation method is similar to NONE in that that there are no null checks.
      NONE
      Disables null and mandatory attribute checks.
      SIMPLE
      Simple validation, verifying that non-null attributes have been provided.
      VALIDATION_API
      Validation using Java Bean Validation API (JSR 303).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ValidationMethod()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Value.Style.ValidationMethod valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Value.Style.ValidationMethod[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • 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 Detail

      • ValidationMethod

        private ValidationMethod()
    • Method Detail

      • values

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

        public static Value.Style.ValidationMethod valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null