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

## Class AbstractFilter

- java.lang.Object
- - org.apache.sling.scripting.sightly.impl.filter.AbstractFilter

All Implemented Interfaces:
  `Comparable<Filter>`, `Filter`

Direct Known Subclasses:
  `FormatFilter`, `I18nFilter`, `JoinFilter`, `URIManipulationFilter`, `XSSFilter`

    public abstract class AbstractFilter
    extends Object
    implements Filter

### Field Summary

Fields
`static Set<ExpressionContext>` `NON_PARAMETRIZABLE_CONTEXTS`
`protected int` `priority`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract Expression` `apply​(Expression expression, Map<String,​ExpressionNode> options)`
`Expression` `apply​(Expression expression, ExpressionContext expressionContext)` Transform the given expression
`int` `compareTo​(Filter o)`
`boolean` `equals​(Object obj)`
`Set<ExpressionContext>` `getApplicableContexts()` Provides the applicable contexts for this filter.
`Set<String>` `getOptions()` Provides the option names this `Filter` will process.
`Set<String>` `getRequiredOptions()` Provides the option names that will trigger a filter's execution.
`int` `hashCode()`
`int` `priority()` The priority with which filters are applied.

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

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

### Field Detail

#### priority

    protected int priority

#### NON_PARAMETRIZABLE_CONTEXTS

    public static final Set<ExpressionContext> NON_PARAMETRIZABLE_CONTEXTS

### Method Detail

#### priority

    public int priority()

Description copied from interface: `Filter`
The priority with which filters are applied. This establishes order between filters. Filters with lower priority are applied first.

Specified by:
  `priority` in interface `Filter`
Returns:
  an integer representing the filter's priority

#### compareTo

    public int compareTo​(Filter o)

Specified by:
  `compareTo` in interface `Comparable<Filter>`

#### apply

    public Expression apply​(Expression expression,
                            ExpressionContext expressionContext)

Description copied from interface: `Filter`
Transform the given expression

Specified by:
  `apply` in interface `Filter`
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

#### apply

    protected abstract Expression apply​(Expression expression,
                                        Map<String,​ExpressionNode> options)

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals​(Object obj)

Overrides:
  `equals` in class `Object`

#### getOptions

    public Set<String> getOptions()

Description copied from interface: `Filter`
Provides the option names this `Filter` will process.

Specified by:
  `getOptions` in interface `Filter`
Returns:
  a set of option names

#### getRequiredOptions

    public Set<String> getRequiredOptions()

Description copied from interface: `Filter`
Provides the option names that will trigger a filter's execution.

Specified by:
  `getRequiredOptions` in interface `Filter`
Returns:
  the required options from an expression in order to trigger the filter

#### getApplicableContexts

    public Set<ExpressionContext> getApplicableContexts()

Description copied from interface: `Filter`
Provides the applicable contexts for this filter.

Specified by:
  `getApplicableContexts` in interface `Filter`
Returns:
  the applicable contexts for this filter