public abstract class Filter extends LValue
| Modifier | Constructor and Description |
|---|---|
protected |
Filter()
Used for all package protected filters in the liqp.filters-package
whose name is their class name lower cased.
|
|
Filter(String name)
Creates a new instance of a Filter.
|
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
apply(Object value,
Object... params)
Applies the filter on the 'value'.
|
void |
checkParams(Object[] params,
int expected)
Check the number of parameters and throws an exception if needed.
|
protected Object |
get(int index,
Object... params)
Returns a value at a specific index from an array of parameters.
|
static Filter |
getFilter(String name)
Retrieves a filter with a specific name.
|
static Map<String,Filter> |
getFilters()
Returns all default filters.
|
static void |
registerFilter(Filter filter)
Registers a new filter.
|
public final String name
protected Filter()
public Filter(String name)
name - the name of the filter.public abstract Object apply(Object value, Object... params)
value - the string value `AAA` in: `{{ 'AAA' | f:1,2,3 }}`params - the values [1, 2, 3] in: `{{ 'AAA' | f:1,2,3 }}`public final void checkParams(Object[] params, int expected)
params - the parameters to check.expected - the expected number of parameters.protected Object get(int index, Object... params)
index - the index of the value to be retrieved.params - the values.public static Filter getFilter(String name)
name - the name of the filter to retrieve.public static Map<String,Filter> getFilters()
public static void registerFilter(Filter filter)
filter - the filter to be registered.Copyright © 2012–2016. All rights reserved.