[ https://issues.apache.org/jira/browse/SLING-6660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15932703#comment-15932703 ]
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 also? 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: https://issues.apache.org/jira/browse/SLING-6660 > 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(); // validator.id > int getSeverity(); // validator.severity > [...] > } > {noformat} > This addition allows less code in {{ValidationModelRetrieverImpl}} and makes > {{ValidatorAndSeverity}} obsolete. -- This message was sent by Atlassian JIRA (v6.3.15#6346)