public class GeneralFilter extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
CONTAINS |
static int |
ENDS_WITH |
static int |
EQUALS |
static int |
GREATER_THAN |
static int |
KEYS |
static int |
LESS_THAN |
static int |
NOT_CONTAINS |
static int |
NOT_EQUALS |
static int |
STARTS_WITH |
static int |
VALUES |
| 构造器和说明 |
|---|
GeneralFilter(Class c) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
accept(Object o) |
void |
addField(String field,
boolean value,
int type)
Add a new field for a boolean comparison.
|
void |
addField(String field,
Date max,
Date min)
Add a new field to check for the date to be in the specified range.
|
void |
addField(String field,
Date value,
int type)
Add a new field for a Date comparison.
|
void |
addField(String field,
double max,
double min)
Add a new field for a number range comparison.
|
void |
addField(String field,
double value,
int type) |
void |
addField(String field,
Object object,
Comparator comp,
int type) |
void |
addField(String field,
Object object,
int type) |
void |
addField(String field,
String value,
int type) |
Collection |
filter(Collection collection) |
void |
filter(Collection collection,
Collection newCollection) |
List |
filter(List list) |
void |
filter(List list,
List newList) |
void |
filter(List list,
Set newSet) |
Map |
filter(Map map,
int type) |
void |
filter(Map map,
int type,
Map newMap) |
Object[] |
filter(Object[] objects) |
Set |
filter(Set set) |
void |
filter(Set set,
List newList) |
void |
filter(Set set,
Set newSet) |
SortedMap |
filter(SortedMap map,
int type) |
SortedSet |
filter(SortedSet set) |
void |
filterAndRemove(Collection col)
Cycle over the Collection and filter given our fields directly from the passed in
Set.
|
void |
filterAndRemove(List list) |
void |
filterAndRemove(Map map,
int type) |
void |
filterAndRemove(Set set)
Cycle over the Set and filter given our fields directly from the passed in
Set.
|
Class |
getFilterClass()
Get the class that we are filtering.
|
boolean |
getNullAcceptPolicy()
Get the null accept policy, this governs what happens when a null is
observed from the result of an accessor chain call,
true
indicates that the value is accepted, false indicates
that it is rejected. |
void |
setFieldValue(String field,
boolean value)
Set a new value for the specified boolean filter field.
|
void |
setFieldValue(String field,
Date value)
Set a new date value for the specified date filter field.
|
void |
setFieldValue(String field,
Date max,
Date min)
Set new date range values for the specified date filter field.
|
void |
setFieldValue(String field,
double value)
Set new maximum and minimum values for the specified number filter field.
|
void |
setFieldValue(String field,
double max,
double min)
Set new maximum and minimum values for the specified number filter field.
|
void |
setFieldValue(String field,
Object value)
Set the value for the specified field.
|
void |
setFieldValue(String field,
String value)
Set the value for the specified String filter field.
|
void |
setNullAcceptPolicy(boolean policy) |
String |
toString()
Output the filter fields as a String suitable for debugging.
|
public static final int EQUALS
public static final int NOT_EQUALS
public static final int GREATER_THAN
public static final int LESS_THAN
public static final int CONTAINS
public static final int NOT_CONTAINS
public static final int STARTS_WITH
public static final int ENDS_WITH
public static final int KEYS
public static final int VALUES
public GeneralFilter(Class c)
public void setNullAcceptPolicy(boolean policy)
public boolean getNullAcceptPolicy()
true
indicates that the value is accepted, false indicates
that it is rejected.public void addField(String field, Date max, Date min) throws IllegalArgumentException
field - The field spec.max - The upper date.min - The lower date.IllegalArgumentException - If the field spec is not valid for the
class set in the constructor.public void setFieldValue(String field, Date max, Date min) throws IllegalArgumentException
field - The field spec.max - The upper date.min - The lower date.IllegalArgumentException - If we can't find the specified field.public void addField(String field, Date value, int type) throws IllegalArgumentException
field - The field spec.value - The Date to check against.type - The type, see above for valid values.IllegalArgumentException - If the field spec is not valid for the
class set in the constructor. Or if you pass in an invalid
type for this method.public void setFieldValue(String field, Date value) throws IllegalArgumentException
field - The field spec.value - The new value.IllegalArgumentException - If we can't find the specified field.public void addField(String field, boolean value, int type) throws IllegalArgumentException
field - The field spec.value - The Date to check against.type - The type, see above for valid values.IllegalArgumentException - If the field spec is not valid for the
class set in the constructor. Or if you pass in an invalid
type for this method.public void setFieldValue(String field, boolean value) throws IllegalArgumentException
field - The field spec.value - The new value.IllegalArgumentException - If we can't find the specified field.public void addField(String field, double value, int type) throws IllegalArgumentException
public void setFieldValue(String field, double value) throws IllegalArgumentException
field - The field spec.value - The new value.IllegalArgumentException - If we can't find the specified field.public void addField(String field, double max, double min)
field - The field spec.max - The maximum value to check against.min - The minimum value to check against.IllegalArgumentException - If the field spec is not valid for the
class set in the constructor.public void setFieldValue(String field, double max, double min) throws IllegalArgumentException
field - The field spec.max - The new maximum to check against.min - The new minimum to check against.IllegalArgumentException - If we can't find the specified field.public void addField(String field, String value, int type) throws IllegalArgumentException
public void setFieldValue(String field, String value) throws IllegalArgumentException
field - The field spec.value - The value to compare against.IllegalArgumentException - If we can't find the specified field.public void addField(String field, Object object, int type) throws IllegalArgumentException
public void setFieldValue(String field, Object value) throws IllegalArgumentException
field - The field spec.value - The value to compare against.IllegalArgumentException - If we can't find the specified field.public void addField(String field, Object object, Comparator comp, int type) throws IllegalArgumentException
public Class getFilterClass()
public boolean accept(Object o) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(Set set, Set newSet) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(Set set, List newList) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(List list, Set newSet) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(Map map, int type, Map newMap) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(Collection collection, Collection newCollection) throws IllegalAccessException, InvocationTargetException, FilterException
public void filter(List list, List newList) throws IllegalAccessException, InvocationTargetException, FilterException
public Object[] filter(Object[] objects) throws IllegalAccessException, InvocationTargetException, FilterException
public Map filter(Map map, int type) throws IllegalAccessException, InvocationTargetException, FilterException
public SortedMap filter(SortedMap map, int type) throws IllegalAccessException, InvocationTargetException, FilterException
public Collection filter(Collection collection) throws IllegalAccessException, InvocationTargetException, FilterException
public Set filter(Set set) throws IllegalAccessException, InvocationTargetException, FilterException
public SortedSet filter(SortedSet set) throws IllegalAccessException, InvocationTargetException, FilterException
public List filter(List list) throws IllegalAccessException, InvocationTargetException, FilterException
public void filterAndRemove(List list) throws IllegalAccessException, InvocationTargetException, FilterException
public void filterAndRemove(Collection col) throws IllegalAccessException, InvocationTargetException, FilterException
col - The Collection to filter.InvocationTargetException - If we cannot execute the associated
Accessor chain and get the
value.IllegalAccessException - If we cannot execute the associated
Accessor chain because of a
security violation.FilterException - Thrown if the return type is not what is
expected from the field type, for example if
we are checking a java.utli.Date but the returned type
is NOT of type java.util.Date.public void filterAndRemove(Set set) throws IllegalAccessException, InvocationTargetException, FilterException
set - The Set to filter.InvocationTargetException - If we cannot execute the associated
Accessor chain and get the
value.IllegalAccessException - If we cannot execute the associated
Accessor chain because of a
security violation.FilterException - Thrown if the return type is not what is
expected from the field type, for example if
we are checking a java.utli.Date but the returned type
is NOT of type java.util.Date.public void filterAndRemove(Map map, int type) throws IllegalAccessException, InvocationTargetException, FilterException
Copyright © 2021. All rights reserved.