Package org.apache.sling.feature.extension.apiregions.api.config.validation

# 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

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 provider
`boolean`
`isLiveValues()`
Are live values validated?
`void`
`setFeatureProvider(org.apache.sling.feature.builder.FeatureProvider provider)`
Set the feature provider
`void`
`setLiveValues(boolean value)`
Set whether live values are validated.
`FeatureValidationResult`
`validate(org.apache.sling.feature.Feature feature)`
Validate the feature against its configuration API
`FeatureValidationResult`
`validate(org.apache.sling.feature.Feature feature, ConfigurationApi api)`
Validate the feature against the configuration API

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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