Package org.apache.sling.scripting.sightly.impl.filter

## Interface Filter

All Superinterfaces:
  `Comparable<Filter>`

All Known Implementing Classes:
  `AbstractFilter`, `FormatFilter`, `I18nFilter`, `JoinFilter`, `URIManipulationFilter`, `XSSFilter`

    public interface Filter
    extends Comparable<Filter>

A filter is a transformation which performs modifications on expressions. Unlike plugins, filters are always applied on an expression. Whether the filter transformation is actually necessary is decided by the filter. The application order of filters is given by filter priority.

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`Expression` `apply​(Expression expression, ExpressionContext expressionContext)` Transform the given expression
`default Set<ExpressionContext>` `getApplicableContexts()` Provides the applicable contexts for this filter.
`default Set<String>` `getOptions()` Provides the option names this `Filter` will process.
`default Set<String>` `getRequiredOptions()` Provides the option names that will trigger a filter's execution.
`int` `priority()` The priority with which filters are applied.

### Methods inherited from interface java.lang.Comparable

`compareTo`

### Method Detail

#### apply

    Expression apply​(Expression expression,
                     ExpressionContext expressionContext)

Transform the given expression

Parameters:
  `expression` - the original expression
  `expressionContext` - the expression's context
Returns:
  a transformed expression. If the filter is not applicable to the given expression, then the original expression shall be returned

#### priority

    int priority()

The priority with which filters are applied. This establishes order between filters. Filters with lower priority are applied first.

Returns:
  an integer representing the filter's priority

#### getOptions

    default Set<String> getOptions()

Provides the option names this `Filter` will process.

Returns:
  a set of option names

#### getRequiredOptions

    default Set<String> getRequiredOptions()

Provides the option names that will trigger a filter's execution.

Returns:
  the required options from an expression in order to trigger the filter

#### getApplicableContexts

    default Set<ExpressionContext> getApplicableContexts()

Provides the applicable contexts for this filter.

Returns:
  the applicable contexts for this filter