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 boolean
applyDefaultValues(org.apache.sling.feature.Feature feature, FeatureValidationResult result)
Apply default values from the result of a validation run.org.apache.sling.feature.builder.FeatureProvider
getFeatureProvider()
Get the current feature providerboolean
isLiveValues()
Are live values validated?void
setFeatureProvider(org.apache.sling.feature.builder.FeatureProvider provider)
Set the feature providervoid
setLiveValues(boolean value)
Set whether live values are validated.FeatureValidationResult
validate(org.apache.sling.feature.Feature feature)
Validate the feature against its configuration APIFeatureValidationResult
validate(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:
true
if 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:
true
if a default value has been applied (the feature has been changed)- Since:
- 1.2
-
-