public class Vtor
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALL_PROFILES |
static java.lang.String |
DEFAULT_PROFILE |
protected java.util.HashSet<java.lang.String> |
enabledProfiles |
protected int |
severity |
protected boolean |
validateAllProfilesByDefault |
protected java.util.List<Violation> |
violations |
| Constructor and Description |
|---|
Vtor() |
| Modifier and Type | Method and Description |
|---|---|
void |
addViolation(Violation v)
Adds new
violation. |
static Vtor |
create()
Static constructor for fluent usage.
|
java.util.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(java.lang.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(java.lang.String profile)
Enables single profile.
|
void |
useProfiles(java.lang.String... enabledProfiles)
Enables list of profiles.
|
java.util.List<Violation> |
validate(java.lang.Object target)
Validate object using context from the annotations.
|
java.util.List<Violation> |
validate(ValidationContext vctx,
java.lang.Object target) |
java.util.List<Violation> |
validate(ValidationContext ctx,
java.lang.Object target,
java.lang.String targetName)
Performs validation of provided validation context and appends violations.
|
public static final java.lang.String DEFAULT_PROFILE
public static final java.lang.String ALL_PROFILES
protected java.util.List<Violation> violations
protected int severity
protected java.util.HashSet<java.lang.String> enabledProfiles
protected boolean validateAllProfilesByDefault
public static Vtor create()
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 java.util.List<Violation> validate(java.lang.Object target)
public java.util.List<Violation> validate(ValidationContext vctx, java.lang.Object target)
public java.util.List<Violation> validate(ValidationContext ctx, java.lang.Object target, java.lang.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(java.lang.String profile)
public void useProfiles(java.lang.String... enabledProfiles)
public void resetProfiles()
setValidateAllProfilesByDefault(boolean)protected boolean matchProfiles(java.lang.String[] checkProfiles)
public java.util.List<Violation> getViolations()
null if validation is successful.public boolean hasViolations()
true if there are validations.Copyright © 2003-present Jodd Team