public interface ValidationRule
Modifier and Type | Method and Description |
---|---|
void |
assertValid(String context,
String input)
Check if the input is valid, throw an Exception otherwise
|
Object |
getSafe(String context,
String input)
Try to call get valid, then call sanitize, finally return a default value
|
String |
getTypeName()
Programmatically supplied name for the validator
|
Object |
getValid(String context,
String input)
Parse the input, throw exceptions if validation fails
|
Object |
getValid(String context,
String input,
ValidationErrorList errorList)
Get a validated value, add the errors to an existing error list
|
boolean |
isValid(String context,
String input) |
void |
setAllowNull(boolean flag)
Whether or not a valid valid can be null.
|
void |
setEncoder(Encoder encoder) |
void |
setTypeName(String typeName) |
String |
whitelist(String input,
char[] list)
String the input of all chars contained in the list
|
String |
whitelist(String input,
Set<Character> list)
String the input of all chars contained in the list
|
Object getValid(String context, String input) throws ValidationException
context
- for logginginput
- the value to be parsedValidationException
- if any validation rules failvoid setAllowNull(boolean flag)
flag
- whether or not null values are valid/safeString getTypeName()
void setTypeName(String typeName)
typeName
- a name, describing the validatorvoid setEncoder(Encoder encoder)
encoder
- the encoder to usevoid assertValid(String context, String input) throws ValidationException
ValidationException
Object getValid(String context, String input, ValidationErrorList errorList) throws ValidationException
ValidationException
Object getSafe(String context, String input)
String whitelist(String input, char[] list)
Copyright © 2016 The Open Web Application Security Project (OWASP). All rights reserved.