java.lang.Object
org.apache.sling.feature.extension.apiregions.api.config.validation.FeatureValidator

public class FeatureValidator extends Object
Validator to validate a feature
  • 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:
      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 feature
      api - The configuration API
      Returns:
      A FeatureValidationResult
      Throws:
      IllegalArgumentException - If api is null
    • 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 configurations
      result - The result
      Returns:
      true if a default value has been applied (the feature has been changed)
      Since:
      1.2