Package org.immutables.value
Enum Value.Style.ValidationMethod
- java.lang.Object
-
- java.lang.Enum<Value.Style.ValidationMethod>
-
- org.immutables.value.Value.Style.ValidationMethod
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Value.Style.ValidationMethod>
- Enclosing class:
- Value.Style
public static enum Value.Style.ValidationMethod extends java.lang.Enum<Value.Style.ValidationMethod>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description MANDATORY_ONLYThis validation method is similar toNONEin that that there are no null checks.NONEDisables null and mandatory attribute checks.SIMPLESimple validation, verifying that non-null attributes have been provided.VALIDATION_APIValidation using Java Bean Validation API (JSR 303).
-
Constructor Summary
Constructors Modifier Constructor Description privateValidationMethod()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Value.Style.ValidationMethodvalueOf(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.
-
-
-
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 toNONEin 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 withnullvalues 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.NotNulland 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
-
-
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 namejava.lang.NullPointerException- if the argument is null
-
-