|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConstraintProcessor<T,C extends Constraint>
ConstraintProcessor must be implemented by constraint processors, which validate individual constraints in the data dictionary
The idea is that each constraint has its own processor, and that the validation service can be configured via dependency injection with a list of processors. This gives institutions the ability to easily modify how validation should be handled and to add arbitrary new constraints and constraint processors.
An alternative might have been to put the process() method into the Constraint marker interface and have each Constraint define its own processing, but that would have forced business logic into what are naturally API classes (classes that implement Constraint). This strategy separates the two functions.
Method Summary | |
---|---|
Class<? extends Constraint> |
getConstraintType()
gets the java class type of the constraint that this contraint processor handles |
String |
getName()
gets a descriptive name of this constraint processor |
boolean |
isOptional()
returns true if the processing of this constraint is something that can be opted out of by some pieces of code. |
ProcessorResult |
process(DictionaryValidationResult result,
T value,
C constraint,
AttributeValueReader attributeValueReader)
process the provided constraint |
Method Detail |
---|
ProcessorResult process(DictionaryValidationResult result, T value, C constraint, AttributeValueReader attributeValueReader) throws AttributeValidationException
result
- - holds dictionary validation resultsvalue
- - the value of the attributeconstraint
- - the constraint to processattributeValueReader
- - - provides access to the attribute being validated
AttributeValidationException
String getName()
e.g. @see CollectionSizeConstraintProcessor.CONSTRAINT_NAME
Class<? extends Constraint> getConstraintType()
Constraint
boolean isOptional()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |