Class FeatureValidator
- java.lang.Object
-
- org.apache.sling.feature.extension.apiregions.api.config.validation.FeatureValidator
-
public class FeatureValidator extends Object
Validator to validate a feature
-
-
Constructor Summary
Constructors Constructor Description FeatureValidator()Create a new feature validator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapplyDefaultValues(org.apache.sling.feature.Feature feature, FeatureValidationResult result)Apply default values from the result of a validation run.org.apache.sling.feature.builder.FeatureProvidergetFeatureProvider()Get the current feature providerbooleanisLiveValues()Are live values validated?voidsetFeatureProvider(org.apache.sling.feature.builder.FeatureProvider provider)Set the feature providervoidsetLiveValues(boolean value)Set whether live values are validated.FeatureValidationResultvalidate(org.apache.sling.feature.Feature feature)Validate the feature against its configuration APIFeatureValidationResultvalidate(org.apache.sling.feature.Feature feature, ConfigurationApi api)Validate the feature against the configuration API
-
-
-
Method Detail
-
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
public FeatureValidationResult validate(org.apache.sling.feature.Feature feature)
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
-
-