Class FeatureValidator
java.lang.Object
org.apache.sling.feature.extension.apiregions.api.config.validation.FeatureValidator
Validator to validate a feature
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyDefaultValues(org.apache.sling.feature.Feature feature, FeatureValidationResult result) Apply default values from the result of a validation run.org.apache.sling.feature.builder.FeatureProviderGet the current feature providerbooleanAre live values validated?voidsetFeatureProvider(org.apache.sling.feature.builder.FeatureProvider provider) Set the feature providervoidsetLiveValues(boolean value) Set whether live values are validated.validate(org.apache.sling.feature.Feature feature) Validate the feature against its configuration APIvalidate(org.apache.sling.feature.Feature feature, ConfigurationApi api) Validate the feature against the configuration API
-
Constructor Details
-
FeatureValidator
public FeatureValidator()Create a new feature validator
-
-
Method Details
-
getFeatureProvider
public org.apache.sling.feature.builder.FeatureProvider getFeatureProvider()Get the current feature provider- Returns:
- the feature provider or
null
-
setFeatureProvider
public void setFeatureProvider(org.apache.sling.feature.builder.FeatureProvider provider) Set the feature provider- Parameters:
provider- the feature provider to set
-
isLiveValues
public boolean isLiveValues()Are live values validated?- Returns:
trueif live values are validated- Since:
- 1.4
-
setLiveValues
public void setLiveValues(boolean value) Set whether live values are validated.- Parameters:
value- Flag for validating live values- Since:
- 1.4
-
validate
Validate the feature against its configuration API- Parameters:
feature- The feature- Returns:
- A
FeatureValidationResult - Throws:
IllegalArgumentException- If api is not available- Since:
- 1.1
-
validate
public FeatureValidationResult validate(org.apache.sling.feature.Feature feature, ConfigurationApi api) Validate the feature against the configuration API- Parameters:
feature- The featureapi- The configuration API- Returns:
- A
FeatureValidationResult - Throws:
IllegalArgumentException- If api isnull
-
applyDefaultValues
public boolean applyDefaultValues(org.apache.sling.feature.Feature feature, FeatureValidationResult result) Apply default values from the result of a validation run. Defaults should be applied, if configuration properties are invalid and the validation mode for such a properties is definitive.- Parameters:
feature- The feature containing the configurationsresult- The result- Returns:
trueif a default value has been applied (the feature has been changed)- Since:
- 1.2
-