play.data.validation

## Class Validation

- java.lang.Object
- - play.data.validation.Validation

    public class Validation
    extends java.lang.Object

### Nested Class Summary

Nested Classes
`static class` `Validation.ValidationResult`
`static class` `Validation.Validator`

### Field Summary

Fields
`static java.lang.ThreadLocal<Validation>` `current`

### Constructor Summary

Constructors
`protected` `Validation()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static void` `addError(java.lang.String field, java.lang.String message, java.lang.String... variables)` Add an error
`static void` `clear()`
`static Validation` `current()`
`Validation.ValidationResult` `email(java.lang.Object o)`
`static Validation.ValidationResult` `email(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `equals(java.lang.Object o, java.lang.Object to)`
`static Validation.ValidationResult` `equals(java.lang.String key, java.lang.Object o, java.lang.String otherName, java.lang.Object to)`
`static Error` `error(java.lang.String field)`
`static java.util.List<Error>` `errors()`
`static java.util.List<Error>` `errors(java.lang.String field)`
`java.util.Map<java.lang.String,java.util.List<Error>>` `errorsMap()`
`Validation.ValidationResult` `future(java.lang.Object o)`
`Validation.ValidationResult` `future(java.lang.Object o, java.util.Date reference)`
`static Validation.ValidationResult` `future(java.lang.String key, java.lang.Object o)`
`static Validation.ValidationResult` `future(java.lang.String key, java.lang.Object o, java.util.Date reference)`
`static java.util.Map<java.lang.String,java.util.List<Validation.Validator>>` `getValidators(java.lang.Class<?> clazz, java.lang.String name)`
`static java.util.List<Validation.Validator>` `getValidators(java.lang.Class<?> clazz, java.lang.String property, java.lang.String name)`
`static boolean` `hasError(java.lang.String field)`
`static boolean` `hasErrors()`
`static boolean` `hasErrors(java.lang.String field)`
`static void` `insertError(int index, java.lang.String field, java.lang.String message, java.lang.String... variables)` Insert an error at the specified position in this list.
`Validation.ValidationResult` `ipv4Address(java.lang.Object o)`
`static Validation.ValidationResult` `ipv4Address(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `ipv6Address(java.lang.Object o)`
`static Validation.ValidationResult` `ipv6Address(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `isTrue(java.lang.Object o)`
`static Validation.ValidationResult` `isTrue(java.lang.String key, java.lang.Object o)`
`static void` `keep()` Keep errors for the next request (will be stored in a cookie)
`Validation.ValidationResult` `match(java.lang.Object o, java.lang.String pattern)`
`static Validation.ValidationResult` `match(java.lang.String key, java.lang.Object o, java.lang.String pattern)`
`Validation.ValidationResult` `max(java.lang.Object o, double max)`
`static Validation.ValidationResult` `max(java.lang.String key, java.lang.Object o, double max)`
`Validation.ValidationResult` `maxSize(java.lang.Object o, int maxSize)`
`static Validation.ValidationResult` `maxSize(java.lang.String key, java.lang.Object o, int maxSize)`
`Validation.ValidationResult` `min(java.lang.Object o, double min)`
`static Validation.ValidationResult` `min(java.lang.String key, java.lang.Object o, double min)`
`Validation.ValidationResult` `minSize(java.lang.Object o, int minSize)`
`static Validation.ValidationResult` `minSize(java.lang.String key, java.lang.Object o, int minSize)`
`Validation.ValidationResult` `past(java.lang.Object o)`
`Validation.ValidationResult` `past(java.lang.Object o, java.util.Date reference)`
`static Validation.ValidationResult` `past(java.lang.String key, java.lang.Object o)`
`static Validation.ValidationResult` `past(java.lang.String key, java.lang.Object o, java.util.Date reference)`
`Validation.ValidationResult` `phone(java.lang.Object o)`
`static Validation.ValidationResult` `phone(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `range(java.lang.Object o, double min, double max)`
`static Validation.ValidationResult` `range(java.lang.String key, java.lang.Object o, double min, double max)`
`static void` `removeErrors(java.lang.String field)` Remove all errors on a field
`static void` `removeErrors(java.lang.String field, java.lang.String message)` Remove all errors on a field with the given message
`Validation.ValidationResult` `required(java.lang.Object o)`
`static Validation.ValidationResult` `required(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `url(java.lang.Object o)`
`static Validation.ValidationResult` `url(java.lang.String key, java.lang.Object o)`
`Validation.ValidationResult` `valid(java.lang.Object o)`
`static Validation.ValidationResult` `valid(java.lang.String key, java.lang.Object o)`
`static java.lang.Object` `willBeValidated(java.lang.Object value)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### current

    public static final java.lang.ThreadLocal<Validation> current

### Constructor Detail

#### Validation

    protected Validation()

### Method Detail

#### current

    public static Validation current()

Returns:
  The current validation helper

#### errors

    public static java.util.List<Error> errors()

Returns:
  The list of all errors

#### errorsMap

    public java.util.Map<java.lang.String,java.util.List<Error>> errorsMap()

Returns:
  All errors keyed by field name

#### addError

    public static void addError(java.lang.String field,
                                java.lang.String message,
                                java.lang.String... variables)

Add an error

Parameters:
  `field` - Field name
  `message` - Message key
  `variables` - Message variables

#### insertError

    public static void insertError(int index,
                                   java.lang.String field,
                                   java.lang.String message,
                                   java.lang.String... variables)

Insert an error at the specified position in this list.

Parameters:
  `index` - index at which the specified element is to be inserted
  `field` - Field name
  `message` - Message key
  `variables` - Message variables

#### removeErrors

    public static void removeErrors(java.lang.String field,
                                    java.lang.String message)

Remove all errors on a field with the given message

Parameters:
  `field` - Field name
  `message` - Message key

#### removeErrors

    public static void removeErrors(java.lang.String field)

Remove all errors on a field

Parameters:
  `field` - Field name

#### hasErrors

    public static boolean hasErrors()

Returns:
  True if the current request has errors

#### hasErrors

    public static boolean hasErrors(java.lang.String field)

Parameters:
  `field` - The field name
Returns:
  true if field has some errors

#### error

    public static Error error(java.lang.String field)

Parameters:
  `field` - The field name
Returns:
  First error related to this field

#### errors

    public static java.util.List<Error> errors(java.lang.String field)

Parameters:
  `field` - The field name
Returns:
  All errors related to this field

#### keep

    public static void keep()

Keep errors for the next request (will be stored in a cookie)

#### hasError

    public static boolean hasError(java.lang.String field)

Parameters:
  `field` - The field name
Returns:
  True is there are errors related to this field

#### clear

    public static void clear()

#### getValidators

    public static java.util.Map<java.lang.String,java.util.List<Validation.Validator>> getValidators(java.lang.Class<?> clazz,
                                                                                                     java.lang.String name)

#### getValidators

    public static java.util.List<Validation.Validator> getValidators(java.lang.Class<?> clazz,
                                                                     java.lang.String property,
                                                                     java.lang.String name)

#### required

    public static Validation.ValidationResult required(java.lang.String key,
                                                       java.lang.Object o)

#### required

    public Validation.ValidationResult required(java.lang.Object o)

#### min

    public static Validation.ValidationResult min(java.lang.String key,
                                                  java.lang.Object o,
                                                  double min)

#### min

    public Validation.ValidationResult min(java.lang.Object o,
                                           double min)

#### max

    public static Validation.ValidationResult max(java.lang.String key,
                                                  java.lang.Object o,
                                                  double max)

#### max

    public Validation.ValidationResult max(java.lang.Object o,
                                           double max)

#### future

    public static Validation.ValidationResult future(java.lang.String key,
                                                     java.lang.Object o,
                                                     java.util.Date reference)

#### future

    public Validation.ValidationResult future(java.lang.Object o,
                                              java.util.Date reference)

#### future

    public static Validation.ValidationResult future(java.lang.String key,
                                                     java.lang.Object o)

#### future

    public Validation.ValidationResult future(java.lang.Object o)

#### past

    public static Validation.ValidationResult past(java.lang.String key,
                                                   java.lang.Object o,
                                                   java.util.Date reference)

#### past

    public Validation.ValidationResult past(java.lang.Object o,
                                            java.util.Date reference)

#### past

    public static Validation.ValidationResult past(java.lang.String key,
                                                   java.lang.Object o)

#### past

    public Validation.ValidationResult past(java.lang.Object o)

#### match

    public static Validation.ValidationResult match(java.lang.String key,
                                                    java.lang.Object o,
                                                    java.lang.String pattern)

#### match

    public Validation.ValidationResult match(java.lang.Object o,
                                             java.lang.String pattern)

#### email

    public static Validation.ValidationResult email(java.lang.String key,
                                                    java.lang.Object o)

#### email

    public Validation.ValidationResult email(java.lang.Object o)

#### url

    public static Validation.ValidationResult url(java.lang.String key,
                                                  java.lang.Object o)

#### url

    public Validation.ValidationResult url(java.lang.Object o)

#### phone

    public static Validation.ValidationResult phone(java.lang.String key,
                                                    java.lang.Object o)

#### phone

    public Validation.ValidationResult phone(java.lang.Object o)

#### ipv4Address

    public static Validation.ValidationResult ipv4Address(java.lang.String key,
                                                          java.lang.Object o)

#### ipv4Address

    public Validation.ValidationResult ipv4Address(java.lang.Object o)

#### ipv6Address

    public static Validation.ValidationResult ipv6Address(java.lang.String key,
                                                          java.lang.Object o)

#### ipv6Address

    public Validation.ValidationResult ipv6Address(java.lang.Object o)

#### isTrue

    public static Validation.ValidationResult isTrue(java.lang.String key,
                                                     java.lang.Object o)

#### isTrue

    public Validation.ValidationResult isTrue(java.lang.Object o)

#### equals

    public static Validation.ValidationResult equals(java.lang.String key,
                                                     java.lang.Object o,
                                                     java.lang.String otherName,
                                                     java.lang.Object to)

#### equals

    public Validation.ValidationResult equals(java.lang.Object o,
                                              java.lang.Object to)

#### range

    public static Validation.ValidationResult range(java.lang.String key,
                                                    java.lang.Object o,
                                                    double min,
                                                    double max)

#### range

    public Validation.ValidationResult range(java.lang.Object o,
                                             double min,
                                             double max)

#### minSize

    public static Validation.ValidationResult minSize(java.lang.String key,
                                                      java.lang.Object o,
                                                      int minSize)

#### minSize

    public Validation.ValidationResult minSize(java.lang.Object o,
                                               int minSize)

#### maxSize

    public static Validation.ValidationResult maxSize(java.lang.String key,
                                                      java.lang.Object o,
                                                      int maxSize)

#### maxSize

    public Validation.ValidationResult maxSize(java.lang.Object o,
                                               int maxSize)

#### valid

    public static Validation.ValidationResult valid(java.lang.String key,
                                                    java.lang.Object o)

#### valid

    public Validation.ValidationResult valid(java.lang.Object o)

#### willBeValidated

    public static java.lang.Object willBeValidated(java.lang.Object value)