Package org.hibernate.internal
Class FilterImpl
- java.lang.Object
-
- org.hibernate.internal.FilterImpl
-
- All Implemented Interfaces:
Serializable
,Filter
public class FilterImpl extends Object implements Filter, Serializable
Implementation of FilterImpl. FilterImpl implements the user's view into enabled dynamic filters, allowing them to set filter parameter values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FilterImpl(FilterDefinition configuration)
Constructs a new FilterImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilterDefinition
getFilterDefinition()
Get the associateddefinition
of this named filter.String
getName()
Get the name of this filter.Object
getParameter(String name)
Get the value of the named parameter for the current filter.Supplier<?>
getParameterResolver(String name)
Map<String,?>
getParameters()
boolean
isAutoEnabled()
Get a flag that defines if the filter should be enabled by default.Filter
setParameter(String name, Object value)
Set the named parameter's value for this filter.Filter
setParameterList(String name, Object[] values)
Set the named parameter's value list for this filter.Filter
setParameterList(String name, Collection<?> values)
Set the named parameter's value list for this filter.void
validate()
Perform validation of the filter state.
-
-
-
Field Detail
-
MARKER
public static final String MARKER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FilterImpl
public FilterImpl(FilterDefinition configuration)
Constructs a new FilterImpl.- Parameters:
configuration
- The filter's global configuration.
-
-
Method Detail
-
getFilterDefinition
public FilterDefinition getFilterDefinition()
Description copied from interface:Filter
Get the associateddefinition
of this named filter.- Specified by:
getFilterDefinition
in interfaceFilter
- Returns:
- The filter definition
-
getName
public String getName()
Get the name of this filter.
-
isAutoEnabled
public boolean isAutoEnabled()
Get a flag that defines if the filter should be enabled by default.- Specified by:
isAutoEnabled
in interfaceFilter
- Returns:
- The flag value.
-
setParameter
public Filter setParameter(String name, Object value) throws IllegalArgumentException
Set the named parameter's value for this filter.- Specified by:
setParameter
in interfaceFilter
- Parameters:
name
- The parameter's name.value
- The value to be applied.- Returns:
- This FilterImpl instance (for method chaining).
- Throws:
IllegalArgumentException
- Indicates that either the parameter was undefined or that the type of the passed value did not match the configured type.
-
setParameterList
public Filter setParameterList(String name, Collection<?> values) throws HibernateException
Set the named parameter's value list for this filter. Used in conjunction with IN-style filter criteria.- Specified by:
setParameterList
in interfaceFilter
- Parameters:
name
- The parameter's name.values
- The values to be expanded into an SQL IN list.- Returns:
- This FilterImpl instance (for method chaining).
- Throws:
HibernateException
-
setParameterList
public Filter setParameterList(String name, Object[] values) throws IllegalArgumentException
Set the named parameter's value list for this filter. Used in conjunction with IN-style filter criteria.- Specified by:
setParameterList
in interfaceFilter
- Parameters:
name
- The parameter's name.values
- The values to be expanded into an SQL IN list.- Returns:
- This FilterImpl instance (for method chaining).
- Throws:
IllegalArgumentException
-
getParameter
public Object getParameter(String name)
Get the value of the named parameter for the current filter.- Parameters:
name
- The name of the parameter for which to return the value.- Returns:
- The value of the named parameter.
-
validate
public void validate() throws HibernateException
Perform validation of the filter state. This is used to verify the state of the filter after its enablement and before its use.- Specified by:
validate
in interfaceFilter
- Throws:
HibernateException
- If the state is not currently valid.
-
-