|
HV-819 establishes a concept for unwrapping values prior to validation. The API/SPI is focused on that particular need but is (hopefully) designed in a way to allow for future evolvement to provide more general means of handling/processing values before they are validated, e.g. values could be converted etc.
The idea is to allow for different kind of value handlers, which are tied to a specific annotation type. To do so, the following would have to happen:
public abstract class ValidatedValueHandler<T, A extends Annotation> {
public void initialize(A annotation) {};
public abstract Object handleValidatedValue(T validatedValue);
public abstract Type getValidatedValueType(Type validatedValueType);
}
-
Retrofit ValidatedValueUnwrapper into a ValidatedValueHandler specialization (this should not affect existing implementations):
public abstract class ValidatedValueUnwrapper<T> extends ValidatedValueHandler<T, UnwrapValidatedValue> {
}
Questions:
-
Should it be possible to apply several handlers to a given element? If so, a means for ordering them would be required.
-
Should it be possible to enable handlers implicitly/globally, i.e. without annotating each concerned element?
|