jodd.vtor
Class Vtor

java.lang.Object
  extended by jodd.vtor.Vtor

public class Vtor
extends java.lang.Object

Vtor validator.


Field Summary
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 Summary
Vtor()
           
 
Method Summary
 void addViolation(Violation v)
          Adds new violation.
 java.util.List<Violation> getViolations()
          Returns the list of validation violations or null if validation is successful.
 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.
 void validate(java.lang.Object target)
          Validate object using context from the annotations.
 void validate(ValidationContext vctx, java.lang.Object target)
           
 void validate(ValidationContext ctx, java.lang.Object target, java.lang.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

DEFAULT_PROFILE

public static final java.lang.String DEFAULT_PROFILE
See Also:
Constant Field Values

ALL_PROFILES

public static final java.lang.String ALL_PROFILES
See Also:
Constant Field Values

violations

protected java.util.List<Violation> violations

severity

protected int severity

enabledProfiles

protected java.util.HashSet<java.lang.String> enabledProfiles

validateAllProfilesByDefault

protected boolean validateAllProfilesByDefault
Constructor Detail

Vtor

public Vtor()
Method Detail

addViolation

public void addViolation(Violation v)
Adds new violation. Violations are added during validation. They can be added after the validation as well, with null check (and constraint).


resetViolations

public void resetViolations()
Resets list of all violations.


validate

public void validate(java.lang.Object target)
Validate object using context from the annotations.


validate

public void validate(ValidationContext vctx,
                     java.lang.Object target)
See Also:
validate(ValidationContext, Object, String)

validate

public void validate(ValidationContext ctx,
                     java.lang.Object target,
                     java.lang.String targetName)
Performs validation of provided validation context and appends violations.


setSeverity

public void setSeverity(int severity)
Set validation severity. Only checks with equal and higher severity will be checked.


isValidateAllProfilesByDefault

public boolean isValidateAllProfilesByDefault()

setValidateAllProfilesByDefault

public void setValidateAllProfilesByDefault(boolean validateAllProfilesByDefault)
Specifies how to validate when no profiles is specified. If set to true, then all profiles will be validated; otherwise, only default profiles will be validated.


useProfile

public void useProfile(java.lang.String profile)
Enables single profile.


useProfiles

public void useProfiles(java.lang.String... enabledProfiles)
Enables list of profiles.


resetProfiles

public void resetProfiles()
Reset profiles by clearing all enabled profiles and setting to default state.

See Also:
setValidateAllProfilesByDefault(boolean)

matchProfiles

protected boolean matchProfiles(java.lang.String[] checkProfiles)
Determine if any of checks profiles is among enabled profiles.


getViolations

public java.util.List<Violation> getViolations()
Returns the list of validation violations or null if validation is successful.



Copyright © 2003-2010 Jodd Team