[ https://issues.apache.org/jira/browse/SLING-6660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15931896#comment-15931896 ]
Oliver Lietz commented on SLING-6660: ------------------------------------- [~kwin], [~cziegeler]: {{severity}} is part of the Java API/SPI anyway, so why not enforce and expose it in {{Validator}} also? And why not enforce {{id}} also instead of throwing an exception at runtime? We can provide a base validator which returns {{0}} for {{severity}} and class name for {{id}}. I really prefer having both in {{Validator}} instead of having {{ValidatorAndSeverity}} in API. bq. Not too sure what is the better solution, though. At least for org.apache.sling.spi.resource.provider.ResourceProvider it is also required to set some service properties (without exposing those values through dedicated methods). Requiring service properties is not my point (that's fine for some cases), but less code in [{{ValidationModelRetrieverImpl}}|https://github.com/apache/sling/blob/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java] and making [{{ValidatorAndSeverity}}|https://github.com/apache/sling/blob/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java] obsolete. > 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)