public class Validation
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Validation.ValidationResult |
static class |
Validation.Validator |
Modifier and Type | Field and Description |
---|---|
static java.lang.ThreadLocal<Validation> |
current |
Modifier | Constructor and Description |
---|---|
protected |
Validation() |
Modifier and Type | Method and Description |
---|---|
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) |
public static final java.lang.ThreadLocal<Validation> current
public static Validation current()
public static java.util.List<Error> errors()
public java.util.Map<java.lang.String,java.util.List<Error>> errorsMap()
public static void addError(java.lang.String field, java.lang.String message, java.lang.String... variables)
field
- Field namemessage
- Message keyvariables
- Message variablespublic static void insertError(int index, java.lang.String field, java.lang.String message, java.lang.String... variables)
index
- index at which the specified element is to be insertedfield
- Field namemessage
- Message keyvariables
- Message variablespublic static void removeErrors(java.lang.String field, java.lang.String message)
field
- Field namemessage
- Message keypublic static void removeErrors(java.lang.String field)
field
- Field namepublic static boolean hasErrors()
public static boolean hasErrors(java.lang.String field)
field
- The field namepublic static Error error(java.lang.String field)
field
- The field namepublic static java.util.List<Error> errors(java.lang.String field)
field
- The field namepublic static void keep()
public static boolean hasError(java.lang.String field)
field
- The field namepublic static void clear()
public static java.util.Map<java.lang.String,java.util.List<Validation.Validator>> getValidators(java.lang.Class<?> clazz, java.lang.String name)
public static java.util.List<Validation.Validator> getValidators(java.lang.Class<?> clazz, java.lang.String property, java.lang.String name)
public static Validation.ValidationResult required(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult required(java.lang.Object o)
public static Validation.ValidationResult min(java.lang.String key, java.lang.Object o, double min)
public Validation.ValidationResult min(java.lang.Object o, double min)
public static Validation.ValidationResult max(java.lang.String key, java.lang.Object o, double max)
public Validation.ValidationResult max(java.lang.Object o, double max)
public static Validation.ValidationResult future(java.lang.String key, java.lang.Object o, java.util.Date reference)
public Validation.ValidationResult future(java.lang.Object o, java.util.Date reference)
public static Validation.ValidationResult future(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult future(java.lang.Object o)
public static Validation.ValidationResult past(java.lang.String key, java.lang.Object o, java.util.Date reference)
public Validation.ValidationResult past(java.lang.Object o, java.util.Date reference)
public static Validation.ValidationResult past(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult past(java.lang.Object o)
public static Validation.ValidationResult match(java.lang.String key, java.lang.Object o, java.lang.String pattern)
public Validation.ValidationResult match(java.lang.Object o, java.lang.String pattern)
public static Validation.ValidationResult email(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult email(java.lang.Object o)
public static Validation.ValidationResult url(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult url(java.lang.Object o)
public static Validation.ValidationResult phone(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult phone(java.lang.Object o)
public static Validation.ValidationResult ipv4Address(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult ipv4Address(java.lang.Object o)
public static Validation.ValidationResult ipv6Address(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult ipv6Address(java.lang.Object o)
public static Validation.ValidationResult isTrue(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult isTrue(java.lang.Object o)
public static Validation.ValidationResult equals(java.lang.String key, java.lang.Object o, java.lang.String otherName, java.lang.Object to)
public Validation.ValidationResult equals(java.lang.Object o, java.lang.Object to)
public static Validation.ValidationResult range(java.lang.String key, java.lang.Object o, double min, double max)
public Validation.ValidationResult range(java.lang.Object o, double min, double max)
public static Validation.ValidationResult minSize(java.lang.String key, java.lang.Object o, int minSize)
public Validation.ValidationResult minSize(java.lang.Object o, int minSize)
public static Validation.ValidationResult maxSize(java.lang.String key, java.lang.Object o, int maxSize)
public Validation.ValidationResult maxSize(java.lang.Object o, int maxSize)
public static Validation.ValidationResult valid(java.lang.String key, java.lang.Object o)
public Validation.ValidationResult valid(java.lang.Object o)
public static java.lang.Object willBeValidated(java.lang.Object value)
Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly