T
- constrainable data typeC
- constraint typepublic interface ConstraintProcessor<T,C extends Constraint>
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.
Modifier and Type | Method and Description |
---|---|
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
|
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 validatedAttributeValidationException
String getName()
e.g. @see CollectionSizeConstraintProcessor.CONSTRAINT_NAME
Class<? extends Constraint> getConstraintType()
Constraint
boolean isOptional()
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.