C
- the type of constraints being createdpublic abstract class FilterFactory<C extends Constraint> extends Object
Query
.Constructor and Description |
---|
FilterFactory() |
Modifier and Type | Method and Description |
---|---|
C |
and(C... constraints)
Combines the list of constraints using AND
|
C |
and(List<C> constraints)
Combines the list of constraints using AND
|
CSVFilter<C> |
containsAll(Mapping field,
sirius.kernel.commons.Value commaSeparatedValues)
Creates a new constraint for the given field which asserts that all of the given values in the string is
present.
|
CSVFilter<C> |
containsAny(Mapping field,
sirius.kernel.commons.Value commaSeparatedValues)
Creates a new constraint for the given field which asserts that one of the given values in the string is
present.
|
C |
containsNone(Mapping field,
Object... values)
Creates a constraint which ensures that the given field doesn't contain any of the given values.
|
OneInField<C> |
containsOne(Mapping field,
Object... values)
Creates a filter builder which ensures that the given field contains at least on of the given values.
|
protected abstract Object |
customTransform(Object value)
Permits to provive database dependent transformations.
|
protected abstract C |
effectiveAnd(List<C> effectiveConstraints)
Combines the list of constraints using AND
|
protected abstract C |
effectiveOr(List<C> effectiveConstraints)
Combines the list of constraints using OR
|
C |
eq(Mapping field,
Object value)
Represents field = value as constraint
|
C |
eqIgnoreEmpty(Mapping field,
Object value)
Represents field = value as constraint
However, if the value is null, no constraint will be generated.
|
C |
eqOrEmpty(Mapping field,
Object value)
Represents field = value OR empty(field) as constraint
|
protected abstract C |
eqValue(Mapping field,
Object value)
Represents field = value as constraint
|
abstract C |
filled(Mapping field)
Generates a constraint which ensures that the given field is filled (not null)
|
C |
gt(Mapping field,
Object value)
Represents field > value as constraint
|
C |
gte(Mapping field,
Object value)
Represents field >= value as constraint
|
C |
gteOrEmpty(Mapping field,
Object value)
Represents field >= value OR empty(field) as constraint
|
C |
gtOrEmpty(Mapping field,
Object value)
Represents field > value OR empty(field) as constraint
|
protected abstract C |
gtValue(Mapping field,
Object value,
boolean orEqual)
Represents field > value as constraint
|
protected abstract C |
invert(C constraint)
Effectively inverts the given constraint
|
C |
lt(Mapping field,
Object value)
Represents field < value as constraint
|
C |
lte(Mapping field,
Object value)
Represents field <= value as constraint
|
C |
lteOrEmpty(Mapping field,
Object value)
Represents field <= OR empty(field) value as constraint
|
C |
ltOrEmpty(Mapping field,
Object value)
Represents field < OR empty(field) value as constraint
|
protected abstract C |
ltValue(Mapping field,
Object value,
boolean orEqual)
Represents field < value as constraint
|
C |
ne(Mapping field,
Object value)
Represents field !
|
protected abstract C |
neValue(Mapping field,
Object value)
Represents field !
|
C |
noneInField(Mapping field,
List<Object> values)
Creates a constraint which ensures that the given field doesn't contain any of the given values.
|
C |
not(C constraint)
Inverts the given constraint.
|
abstract C |
notFilled(Mapping field)
Generates a constraint which ensures that the given field is not filled (null)
|
OneInField<C> |
oneInField(Mapping field,
List<Object> values)
Creates a filter builder which ensures that the given field contains at least on of the given values.
|
C |
or(C... constraints)
Combines the list of constraints using OR
|
C |
or(List<C> constraints)
Combines the list of constraints using OR
|
abstract C |
queryString(EntityDescriptor descriptor,
String query,
List<QueryField> fields)
Compiles the given query for the given entity while searching in the given fields.
|
C |
queryString(EntityDescriptor descriptor,
String query,
QueryField... fields)
Compiles the given query for the given entity while searching in the given fields.
|
Object |
transform(Object value)
Transforms a given value into the representation expected by the database.
|
public Object transform(Object value)
value
- the value to tranformprotected abstract Object customTransform(Object value)
value
- the value to tranformpublic C eq(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter withprotected abstract C eqValue(Mapping field, @Nonnull Object value)
field
- the field to filtervalue
- the value to filter with@Nullable public C eqIgnoreEmpty(Mapping field, Object value)
However, if the value is null, no constraint will be generated.
field
- the field to filtervalue
- the value to filter withpublic C eqOrEmpty(Mapping field, Object value)
field
- the field to filtervalue
- the value to filter withpublic C ne(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter withprotected abstract C neValue(Mapping field, @Nonnull Object value)
field
- the field to filtervalue
- the value to filter with@Nullable public C gt(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nonnull protected abstract C gtValue(Mapping field, @Nonnull Object value, boolean orEqual)
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field >= value is used as comparator@Nullable public C gtOrEmpty(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nullable public C gte(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nullable public C gteOrEmpty(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nullable public C lt(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nonnull protected abstract C ltValue(Mapping field, @Nonnull Object value, boolean orEqual)
field
- the field to filtervalue
- the value to filter withorEqual
- if true, field <= value is used as comparator@Nullable public C ltOrEmpty(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nullable public C lte(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generated@Nullable public C lteOrEmpty(Mapping field, @Nullable Object value)
field
- the field to filtervalue
- the value to filter with. If null is passed in, no constraint is generatedpublic abstract C filled(Mapping field)
field
- the field to checkpublic abstract C notFilled(Mapping field)
field
- the field to check@Nullable public C not(@Nullable C constraint)
constraint
- the constraint to invert.@Nonnull protected abstract C invert(@Nonnull C constraint)
constraint
- the constraint to invert@Nullable public final C and(List<C> constraints)
constraints
- the constraints to combine@Nullable @SafeVarargs public final C and(C... constraints)
constraints
- the constraints to combine@Nonnull protected abstract C effectiveAnd(List<C> effectiveConstraints)
effectiveConstraints
- the constraints to combine (where each value will be non-null)@Nullable public final C or(List<C> constraints)
constraints
- the constraints to combine@Nullable @SafeVarargs public final C or(C... constraints)
constraints
- the constraints to combine@Nonnull protected abstract C effectiveOr(List<C> effectiveConstraints)
effectiveConstraints
- the constraints to combine (where each value will be non-null)public OneInField<C> containsOne(Mapping field, Object... values)
field
- the field to filter onvalues
- the values to checkpublic OneInField<C> oneInField(Mapping field, List<Object> values)
field
- the field to filter onvalues
- the values to checkpublic C containsNone(Mapping field, Object... values)
field
- the field to filter onvalues
- the values to checkpublic C noneInField(Mapping field, List<Object> values)
field
- the field to filter onvalues
- the values to checkpublic CSVFilter<C> containsAny(Mapping field, sirius.kernel.commons.Value commaSeparatedValues)
The string can have a form like A,B,C or A|B|C.
field
- the field to checkcommaSeparatedValues
- the comma separated values to check forpublic CSVFilter<C> containsAll(Mapping field, sirius.kernel.commons.Value commaSeparatedValues)
The string can have a form like A,B,C or A|B|C.
field
- the field to checkcommaSeparatedValues
- the comma separated values to check forpublic C queryString(EntityDescriptor descriptor, String query, QueryField... fields)
descriptor
- the descriptor of the entity being searchedquery
- the query to compilefields
- the default fields to search inpublic abstract C queryString(EntityDescriptor descriptor, String query, List<QueryField> fields)
descriptor
- the descriptor of the entity being searchedquery
- the query to compilefields
- the default fields to search inCopyright © 2018. All rights reserved.