play.data.validation
Class Constraints

java.lang.Object
  extended by play.data.validation.Constraints

public class Constraints
extends java.lang.Object

Defines a set of built-in validation constraints.


Nested Class Summary
static interface Constraints.Email
          Defines a email constraint for a string field.
static class Constraints.EmailValidator
          Validator for @Email fields.
static interface Constraints.Max
          Defines a maximum value for a numeric field.
static interface Constraints.MaxLength
          Defines a maxmimum length for a string field.
static class Constraints.MaxLengthValidator
          Validator for @MaxLength fields.
static class Constraints.MaxValidator
          Validator for @Max fields.
static interface Constraints.Min
          Defines a minumum value for a numeric field.
static interface Constraints.MinLength
          Defines a minumum length for a string field.
static class Constraints.MinLengthValidator
          Validator for @MinLength fields.
static class Constraints.MinValidator
          Validator for @Min fields.
static interface Constraints.Pattern
          Defines a pattern constraint for a string field.
static class Constraints.PatternValidator
          Validator for @Pattern fields.
static interface Constraints.Required
          Defines a field as required.
static class Constraints.RequiredValidator
          Validator for @Required fields.
static class Constraints.Validator<T>
          Super-type for validators.
 
Constructor Summary
Constraints()
           
 
Method Summary
static java.util.List<F.Tuple<java.lang.String,java.util.List<java.lang.Object>>> displayableConstraint(java.util.Set<javax.validation.metadata.ConstraintDescriptor<?>> constraints)
          Converts a set of constraints to human-readable values.
static Constraints.Validator<java.lang.String> email()
          Constructs a 'email' validator.
static Constraints.Validator<java.lang.Number> max(long value)
          Constructs a 'max' validator.
static Constraints.Validator<java.lang.String> maxLength(long value)
          Constructs a 'maxLength' validator.
static Constraints.Validator<java.lang.Number> min(long value)
          Constructs a 'min' validator.
static Constraints.Validator<java.lang.String> minLength(long value)
          Constructs a 'minLength' validator.
static Constraints.Validator<java.lang.String> pattern(java.lang.String regex)
          Constructs a 'pattern' validator.
static Constraints.Validator<java.lang.Object> required()
          Constructs a 'required' validator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Constraints

public Constraints()
Method Detail

displayableConstraint

public static java.util.List<F.Tuple<java.lang.String,java.util.List<java.lang.Object>>> displayableConstraint(java.util.Set<javax.validation.metadata.ConstraintDescriptor<?>> constraints)
Converts a set of constraints to human-readable values.


required

public static Constraints.Validator<java.lang.Object> required()
Constructs a 'required' validator.


min

public static Constraints.Validator<java.lang.Number> min(long value)
Constructs a 'min' validator.


max

public static Constraints.Validator<java.lang.Number> max(long value)
Constructs a 'max' validator.


minLength

public static Constraints.Validator<java.lang.String> minLength(long value)
Constructs a 'minLength' validator.


maxLength

public static Constraints.Validator<java.lang.String> maxLength(long value)
Constructs a 'maxLength' validator.


email

public static Constraints.Validator<java.lang.String> email()
Constructs a 'email' validator.


pattern

public static Constraints.Validator<java.lang.String> pattern(java.lang.String regex)
Constructs a 'pattern' validator.