Class MapModelCriteriaBuilder<K,V extends AbstractEntity,M>
java.lang.Object
org.keycloak.models.map.storage.chm.MapModelCriteriaBuilder<K,V,M>
- All Implemented Interfaces:
ModelCriteriaBuilder<M,
MapModelCriteriaBuilder<K, V, M>>
- Direct Known Subclasses:
MapModelCriteriaBuilderAssumingEqualForField
public class MapModelCriteriaBuilder<K,V extends AbstractEntity,M>
extends Object
implements ModelCriteriaBuilder<M,MapModelCriteriaBuilder<K,V,M>>
- Author:
- hmlnarik
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Nested classes/interfaces inherited from interface org.keycloak.models.map.storage.ModelCriteriaBuilder
ModelCriteriaBuilder.Operator
-
Field Summary
Modifier and TypeFieldDescription -
Constructor Summary
ModifierConstructorDescriptionMapModelCriteriaBuilder
(StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates) protected
MapModelCriteriaBuilder
(StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates, Predicate<? super K> indexReadFilter, Predicate<? super V> sequentialReadFilter) -
Method Summary
Modifier and TypeMethodDescriptionfinal MapModelCriteriaBuilder<K,
V, M> and
(MapModelCriteriaBuilder<K, V, M>... builders) Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean AND operator.compare
(SearchableModelField<? super M> modelField, ModelCriteriaBuilder.Operator op, Object... values) Adds a constraint for the given model field to this criteria builder and returns a criteria builder that is combined with the the new constraint.protected Object[]
convertValuesToKeyType
(Object[] values) protected MapModelCriteriaBuilder<K,
V, M> fieldCompare
(Predicate<Object> valueComparator, Function<V, ?> getter) protected MapModelCriteriaBuilder<K,
V, M> fieldCompare
(ModelCriteriaBuilder.Operator op, Function<V, ?> getter, Object[] values) protected MapModelCriteriaBuilder<K,
V, M> idCompare
(ModelCriteriaBuilder.Operator op, Object[] values) protected MapModelCriteriaBuilder<K,
V, M> instantiateNewInstance
(StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates, Predicate<? super K> indexReadFilter, Predicate<? super V> sequentialReadFilter) Return a new instance for nodes in this criteria tree.not
(MapModelCriteriaBuilder<K, V, M> builder) Creates and returns a new instance ofModelCriteriaBuilder
that negates the given builder.final MapModelCriteriaBuilder<K,
V, M> or
(MapModelCriteriaBuilder<K, V, M>... builders) Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean OR operator.
-
Field Details
-
ALWAYS_TRUE
-
ALWAYS_FALSE
-
-
Constructor Details
-
MapModelCriteriaBuilder
public MapModelCriteriaBuilder(StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates) -
MapModelCriteriaBuilder
protected MapModelCriteriaBuilder(StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates, Predicate<? super K> indexReadFilter, Predicate<? super V> sequentialReadFilter)
-
-
Method Details
-
compare
public MapModelCriteriaBuilder<K,V, compareM> (SearchableModelField<? super M> modelField, ModelCriteriaBuilder.Operator op, Object... values) Description copied from interface:ModelCriteriaBuilder
Adds a constraint for the given model field to this criteria builder and returns a criteria builder that is combined with the the new constraint. The resulting constraint is a logical conjunction (i.e. AND) of the original constraint present in thisModelCriteriaBuilder
and the given operator.- Specified by:
compare
in interfaceModelCriteriaBuilder<K,
V extends AbstractEntity> - Parameters:
modelField
- Field on the logical model to be constrainedop
- Operatorvalues
- Additional operands of the operator.- Returns:
-
and
@SafeVarargs public final MapModelCriteriaBuilder<K,V, andM> (MapModelCriteriaBuilder<K, V, M>... builders) Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean AND operator.Predicate coming out of
and
on an empty array ofbuilders
(i.e. empty conjunction) is alwaystrue
.cb = storage.getCriteriaBuilder(); storage.read(cb.or( cb.and(cb.compare(FIELD1, EQ, 1), cb.compare(FIELD2, EQ, 2)), cb.and(cb.compare(FIELD1, EQ, 3), cb.compare(FIELD2, EQ, 4)) );
- Specified by:
and
in interfaceModelCriteriaBuilder<K,
V extends AbstractEntity>
-
or
@SafeVarargs public final MapModelCriteriaBuilder<K,V, orM> (MapModelCriteriaBuilder<K, V, M>... builders) Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that combines the given builders with the Boolean OR operator.Predicate coming out of
or
on an empty array ofbuilders
(i.e. empty disjunction) is alwaysfalse
.cb = storage.getCriteriaBuilder(); storage.read(cb.or( cb.compare(FIELD1, EQ, 1).compare(FIELD2, EQ, 2), cb.compare(FIELD1, EQ, 3).compare(FIELD2, EQ, 4) );
- Specified by:
or
in interfaceModelCriteriaBuilder<K,
V extends AbstractEntity>
-
not
Description copied from interface:ModelCriteriaBuilder
Creates and returns a new instance ofModelCriteriaBuilder
that negates the given builder.Note that if the
builder
has no condition yet, there is nothing to negate: empty negation is alwaystrue
.- Specified by:
not
in interfaceModelCriteriaBuilder<K,
V extends AbstractEntity> - Returns:
-
getKeyFilter
-
getEntityFilter
-
idCompare
protected MapModelCriteriaBuilder<K,V, idCompareM> (ModelCriteriaBuilder.Operator op, Object[] values) -
convertValuesToKeyType
-
fieldCompare
protected MapModelCriteriaBuilder<K,V, fieldCompareM> (ModelCriteriaBuilder.Operator op, Function<V, ?> getter, Object[] values) -
fieldCompare
-
instantiateNewInstance
protected MapModelCriteriaBuilder<K,V, instantiateNewInstanceM> (StringKeyConverter<K> keyConverter, Map<SearchableModelField<? super M>, MapModelCriteriaBuilder.UpdatePredicatesFunc<K, V, M>> fieldPredicates, Predicate<? super K> indexReadFilter, Predicate<? super V> sequentialReadFilter) Return a new instance for nodes in this criteria tree. Subclasses can override this method to instantiate a new instance of their subclass. This allows this class to be extendable.
-