|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjodd.vtor.Vtor
public class Vtor
Vtor validator.
| Field Summary | |
|---|---|
static String |
ALL_PROFILES
|
static String |
DEFAULT_PROFILE
|
protected HashSet<String> |
enabledProfiles
|
protected int |
severity
|
protected boolean |
validateAllProfilesByDefault
|
protected List<Violation> |
violations
|
| Constructor Summary | |
|---|---|
Vtor()
|
|
| Method Summary | |
|---|---|
void |
addViolation(Violation v)
Adds new violation. |
List<Violation> |
getViolations()
Returns the list of validation violations or null if validation is successful. |
boolean |
hasViolations()
Returns true if there are validations. |
boolean |
isValidateAllProfilesByDefault()
|
protected boolean |
matchProfiles(String[] checkProfiles)
Determine if any of checks profiles is among enabled profiles. |
void |
resetProfiles()
Reset profiles by clearing all enabled profiles and setting to default state. |
void |
resetViolations()
Resets list of all violations. |
void |
setSeverity(int severity)
Set validation severity. |
void |
setValidateAllProfilesByDefault(boolean validateAllProfilesByDefault)
Specifies how to validate when no profiles is specified. |
void |
useProfile(String profile)
Enables single profile. |
void |
useProfiles(String... enabledProfiles)
Enables list of profiles. |
void |
validate(Object target)
Validate object using context from the annotations. |
void |
validate(ValidationContext vctx,
Object target)
|
void |
validate(ValidationContext ctx,
Object target,
String targetName)
Performs validation of provided validation context and appends violations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_PROFILE
public static final String ALL_PROFILES
protected List<Violation> violations
protected int severity
protected HashSet<String> enabledProfiles
protected boolean validateAllProfilesByDefault
| Constructor Detail |
|---|
public Vtor()
| Method Detail |
|---|
public void addViolation(Violation v)
violation. Violations are added during validation.
They can be added after the validation as well, with null check (and constraint).
public void resetViolations()
public void validate(Object target)
public void validate(ValidationContext vctx,
Object target)
validate(ValidationContext, Object, String)
public void validate(ValidationContext ctx,
Object target,
String targetName)
public void setSeverity(int severity)
public boolean isValidateAllProfilesByDefault()
public void setValidateAllProfilesByDefault(boolean validateAllProfilesByDefault)
true, then all profiles will be validated;
otherwise, only default profiles will be validated.
public void useProfile(String profile)
public void useProfiles(String... enabledProfiles)
public void resetProfiles()
setValidateAllProfilesByDefault(boolean)protected boolean matchProfiles(String[] checkProfiles)
public List<Violation> getViolations()
null if validation is successful.
public boolean hasViolations()
true if there are validations.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||