| java.lang.Object net.sf.oval.Validator
All known Subclasses: net.sf.oval.guard.Guard,
Validator | public class Validator (Code) | | author: Sebastian Thomschke |
Method Summary | |
public void | addChecks(Class clazz, Check... checks) | protected void | addChecks(ClassChecks cc, ClassConfiguration classConfig) | public void | addChecks(Field field, Check... checks) | public void | addChecks(Method invariantMethod, Check... checks) | public void | addConstraintSet(ConstraintSet constraintSet, boolean overwrite) Registers a new constraint set. | public void | addExpressionLanguage(String languageId, ExpressionLanguage expressionLanguage) | public void | assertValid(Object validatedObject) | public void | assertValidFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate) | protected void | checkConstraint(List<ConstraintViolation> violations, Check check, Object validatedObject, Object valueToValidate, OValContext context) | protected void | checkConstraintAssertConstraintSet(List<ConstraintViolation> violations, AssertConstraintSetCheck check, Object validatedObject, Object valueToValidate, OValContext context) | protected void | checkConstraintAssertFieldConstraints(List<ConstraintViolation> violations, AssertFieldConstraintsCheck check, Object validatedObject, Object valueToValidate, OValContext context) | protected void | checkConstraintAssertValid(List<ConstraintViolation> violations, AssertValidCheck check, Object validatedObject, Object valueToValidate, OValContext context) | public synchronized void | disableAllProfiles() Enables all constraint profiles, i.e. | public void | disableProfile(String profile) Disables a constraints profile. | public synchronized void | enableAllProfiles() Disables all constraint profiles, i.e. | public void | enableProfile(String profile) Enables a constraints profile. | public Check[] | getChecks(Class clazz) | public Check[] | getChecks(Field field) | public Check[] | getChecks(Method method) | protected ClassChecks | getClassChecks(Class clazz) | public static CollectionFactory | getCollectionFactory() | public List<Configurer> | getConfigurers() | public ConstraintSet | getConstraintSet(String constraintSetId) | public ExceptionTranslator | getExceptionTranslator() | public ExpressionLanguage | getExpressionLanguage(String languageId) | public static LoggerFactory | getLoggerFactory() | public static MessageResolver | getMessageResolver() | protected boolean | isAnyProfileEnabled(String[] profileIds) Determines if at least one of the given profiles is enabled
Parameters: profileIds - Returns true if at least one of the given profiles is enabled. | protected boolean | isCurrentlyValidated(Object object) | public boolean | isProfileEnabled(String profileId) Determines if the given profile is enabled. | public void | reconfigureChecks() | public void | removeChecks(Class clazz, Check... checks) | public void | removeChecks(Field field, Check... checks) | public void | removeChecks(Method getter, Check... checks) | public ConstraintSet | removeConstraintSet(String id) | protected String | renderMessage(OValContext context, Object value, String messageKey, Map<String, String> messageValues) | public static void | setCollectionFactory(CollectionFactory factory) | public void | setExceptionTranslator(ExceptionTranslator exceptionTranslator) | public static void | setLoggerFactory(LoggerFactory loggerFactory) | public static void | setMessageResolver(MessageResolver messageResolver) | protected RuntimeException | translateException(OValException ex) | public List<ConstraintViolation> | validate(Object validatedObject) validates the field and getter constrains of the given object
Parameters: validatedObject - the object to validate, cannot be null a list with the detected constraint violations. | public List<ConstraintViolation> | validateFieldValue(Object validatedObject, Field validatedField, Object fieldValueToValidate) Validates the give value against the defined field constraints.
a list with the detected constraint violations. | protected void | validateInvariants(Object validatedObject, List<ConstraintViolation> violations) validates the field and getter constrains of the given object. |
Validator | public Validator()(Code) | | Constructs a new validator object and uses a new isntance of
AnnotationsConfigurer
|
disableAllProfiles | public synchronized void disableAllProfiles()(Code) | | Enables all constraint profiles, i.e. all configured constraint will be validated.
|
disableProfile | public void disableProfile(String profile)(Code) | | Disables a constraints profile.
Parameters: profile - the id of the profile |
enableAllProfiles | public synchronized void enableAllProfiles()(Code) | | Disables all constraint profiles, i.e. no configured constraint will be validated.
|
enableProfile | public void enableProfile(String profile)(Code) | | Enables a constraints profile.
Parameters: profile - the id of the profile |
getCollectionFactory | public static CollectionFactory getCollectionFactory()(Code) | | Returns a shared instance of the CollectionFactory
|
getConfigurers | public List<Configurer> getConfigurers()(Code) | | the internal list with the registered configurers |
isAnyProfileEnabled | protected boolean isAnyProfileEnabled(String[] profileIds)(Code) | | Determines if at least one of the given profiles is enabled
Parameters: profileIds - Returns true if at least one of the given profiles is enabled. |
isCurrentlyValidated | protected boolean isCurrentlyValidated(Object object)(Code) | | Determines if the given object is currently validated in the current thread
Parameters: object - Returns true if the given object is currently validated in the current thread. |
isProfileEnabled | public boolean isProfileEnabled(String profileId)(Code) | | Determines if the given profile is enabled.
Parameters: profileId - Returns true if the given profile is enabled. |
reconfigureChecks | public void reconfigureChecks()(Code) | | clears the checks and constraint sets => a reconfiguration using the
currently registered configurers will automatically happen
|
setExceptionTranslator | public void setExceptionTranslator(ExceptionTranslator exceptionTranslator)(Code) | | Parameters: exceptionTranslator - the exceptionTranslator to set |
setLoggerFactory | public static void setLoggerFactory(LoggerFactory loggerFactory)(Code) | | Parameters: loggerFactory - the loggerFactory to set |
|
|