sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konrad Windszus (JIRA)" <>
Subject [jira] [Commented] (SLING-6660) Validators should expose their id and severity
Date Mon, 20 Mar 2017 14:17:41 GMT


Konrad Windszus commented on SLING-6660:

bq. severity is part of the Java API/SPI anyway, so why not enforce and expose it in Validator
Because that way this information is duplicated. Even if we move the logic of exposing ID
and severity from the service property into an abstract class, a {{Validator}} could decide
to overwrite those methods or not derive from the abstract class at all. That is something
I want to prevent, because that would prevent overwriting those values and also does not allow
to easily debug those values (via the web console).

bq. Requiring service properties is not my point (that's fine for some cases), but less code
in ValidationModelRetrieverImpl and making ValidatorAndSeverity obsolete.
I understand that, but IMHO the code in {{ValidationModelRetrieverImpl}} is easy to understand
and pretty straightforward. With OSGi R7 we might even fully rely on field injection.
{{ValidatorAndSeverity}} is only used within validation models, therefore all consumers of
Sling Validation won't ever get in contact with that class. Only if you want to implement
your own {{ValidationModelProvider}} you need that class.

> Validators should expose their id and severity
> ----------------------------------------------
>                 Key: SLING-6660
>                 URL:
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions, Validation
>            Reporter: Oliver Lietz
> {{Validator}}s should expose their {{id}} and {{severity}} (maybe from service properties,
but haven't to be service properties at all) by their own:
> {noformat}
> [...]
> public interface Validator <T> {
> [...]
>     String getId(); //
>     int getSeverity(); // validator.severity
> [...]
> }
> {noformat}
> This addition allows less code in {{ValidationModelRetrieverImpl}} and makes {{ValidatorAndSeverity}}

This message was sent by Atlassian JIRA

View raw message