Package rife.validation
Class ValidationError
java.lang.Object
rife.validation.ValidationError
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
ValidationError.DIFFERENT
,ValidationError.INCOMPLETE
,ValidationError.INVALID
,ValidationError.MANDATORY
,ValidationError.NOT_NUMERIC
,ValidationError.UNEXPECTED
,ValidationError.UNIQUENESS
,ValidationError.WRONG_FORMAT
,ValidationError.WRONG_LENGTH
Instances of this class detail subjects that were found invalid during
validation.
Each ValidationError
is tied to a specific subject and
provides more information through an explicative textual identifier.
A collection of commonly used identifiers and implementations are provided as static member variables and static inner classes.
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
static class
static class
-
Field Summary
-
Constructor Summary
ConstructorDescriptionValidationError
(String identifier, String subject) Creates a newValidationError
instance for the specified identifier and subject.ValidationError
(String identifier, String subject, boolean overridable) Creates a newValidationError
instance for the specified identifier and subject. -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
erroneousValue
(Object erroneousValue) Chainable setter to make validation error construction easierReturns the erroneous value that caused the validation error, if it's present.final String
Returns the textual identifier that categorizes this validation error.final String
Returns the erroneous subject name of this validation error.int
hashCode()
final boolean
Returns whether this error is overridable for the same subject.void
setErroneousValue
(Object erroneousValue) Stores the erroneous value that caused the validation error.
-
Field Details
-
IDENTIFIER_MANDATORY
- See Also:
-
IDENTIFIER_UNIQUENESS
- See Also:
-
IDENTIFIER_WRONG_LENGTH
- See Also:
-
IDENTIFIER_WRONG_FORMAT
- See Also:
-
IDENTIFIER_NOT_NUMERIC
- See Also:
-
IDENTIFIER_UNEXPECTED
- See Also:
-
IDENTIFIER_INCOMPLETE
- See Also:
-
IDENTIFIER_INVALID
- See Also:
-
IDENTIFIER_DIFFERENT
- See Also:
-
-
Constructor Details
-
ValidationError
Creates a newValidationError
instance for the specified identifier and subject.The error will not be automatic overridable.
- Parameters:
identifier
- a non-null
String
with the textual error identifiersubject
- a non-null
String
with the name of the erroneous subject- Since:
- 1.0
-
ValidationError
Creates a newValidationError
instance for the specified identifier and subject.- Parameters:
identifier
- a non-null
String
with the textual error identifiersubject
- a non-null
String
with the name of the erroneous subjectoverridable
-true
to make any other error for the same subject override this error,false
if this error should always be shown- Since:
- 1.0
-
-
Method Details
-
getIdentifier
Returns the textual identifier that categorizes this validation error.- Since:
- 1.0
-
getSubject
Returns the erroneous subject name of this validation error.- Since:
- 1.0
-
isOverridable
public final boolean isOverridable()Returns whether this error is overridable for the same subject.- Since:
- 1.0
-
setErroneousValue
Stores the erroneous value that caused the validation error. This is optional and should only be done when the erroneous value gives more information from the context in which the validation error occurred.- Since:
- 1.0
-
erroneousValue
Chainable setter to make validation error construction easier- Since:
- 1.0
- See Also:
-
getErroneousValue
Returns the erroneous value that caused the validation error, if it's present.- Since:
- 1.0
-
clone
-
hashCode
public int hashCode() -
equals
-