Package org.apache.cayenne.validation
Class BeanValidationFailure
java.lang.Object
org.apache.cayenne.validation.SimpleValidationFailure
org.apache.cayenne.validation.BeanValidationFailure
- All Implemented Interfaces:
Serializable,ValidationFailure
ValidationFailure implementation that described a failure of a single named property of
a Java Bean object.
- Since:
- 1.1
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.cayenne.validation.SimpleValidationFailure
error, source -
Constructor Summary
ConstructorsConstructorDescriptionBeanValidationFailure(Object source, String property, Object error) Creates new BeanValidationFailure. -
Method Summary
Modifier and TypeMethodDescriptionReturns a failed property of the failure source object.toString()Returns a String representation of the failure.static ValidationFailurevalidateJavaClassName(Object bean, String attribute, String identifier) A utility method that checks that a given string is a valid Java full class name, returning a non-null ValidationFailure if this is not so.static ValidationFailurevalidateMandatory(Object bean, String attribute) static ValidationFailurevalidateMandatory(Object bean, String attribute, Object value) static ValidationFailurevalidateNotEmpty(Object bean, String attribute, String value) A utility method that returns a ValidationFailure if a string is either null or has a length of zero; otherwise returns null.static ValidationFailurevalidateNotEmpty(Object bean, String attribute, Collection<?> value) Returns a ValidationFailure if a collection attribute of an object is null or empty.static ValidationFailurevalidateNotNull(Object bean, String attribute, Object value) Methods inherited from class org.apache.cayenne.validation.SimpleValidationFailure
getDescription, getError, getSource
-
Field Details
-
property
-
-
Constructor Details
-
BeanValidationFailure
Creates new BeanValidationFailure.
-
-
Method Details
-
validateNotEmpty
public static ValidationFailure validateNotEmpty(Object bean, String attribute, Collection<?> value) Returns a ValidationFailure if a collection attribute of an object is null or empty. -
validateMandatory
-
validateMandatory
-
validateNotNull
-
validateNotEmpty
A utility method that returns a ValidationFailure if a string is either null or has a length of zero; otherwise returns null. -
validateJavaClassName
public static ValidationFailure validateJavaClassName(Object bean, String attribute, String identifier) A utility method that checks that a given string is a valid Java full class name, returning a non-null ValidationFailure if this is not so. Special case: primitive arrays like byte[] are also handled as a valid java class name.- Since:
- 1.2
-
getProperty
Returns a failed property of the failure source object. -
toString
Returns a String representation of the failure.- Overrides:
toStringin classSimpleValidationFailure
-