Package org.mybatis.dynamic.sql
Class AbstractListValueCondition<T>
java.lang.Object
org.mybatis.dynamic.sql.AbstractListValueCondition<T>
- All Implemented Interfaces:
VisitableCondition<T>
- Direct Known Subclasses:
IsIn
,IsInCaseInsensitive
,IsNotIn
,IsNotInCaseInsensitive
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Callback
Deprecated.in favor of the statement configuration functionsprotected final Collection<T>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractListValueCondition
(Collection<T> values) protected
AbstractListValueCondition
(Collection<T> values, Callback emptyCallback) Deprecated.in favor of the statement configuration functions -
Method Summary
Modifier and TypeMethodDescription<R> R
accept
(ConditionVisitor<T, R> visitor) abstract AbstractListValueCondition<T>
If renderable, apply the predicate to each value in the list and return a new condition with the filtered values.protected <S extends AbstractListValueCondition<T>>
SfilterSupport
(Predicate<? super T> predicate, BiFunction<Collection<T>, Callback, S> constructor, S self, Supplier<S> emptySupplier) protected <R,
S extends AbstractListValueCondition<R>>
SmapSupport
(Function<? super T, ? extends R> mapper, BiFunction<Collection<R>, Callback, S> constructor, Supplier<S> emptySupplier) final <R> Stream<R>
abstract String
renderCondition
(String columnName, Stream<String> placeholders) void
This method will be called during rendering whenVisitableCondition.shouldRender()
returns false.boolean
Subclasses can override this to inform the renderer if the condition should not be included in the rendered SQL.abstract AbstractListValueCondition<T>
withListEmptyCallback
(Callback callback) Deprecated.in favor of the statement configuration functions
-
Field Details
-
values
-
emptyCallback
Deprecated.in favor of the statement configuration functionsCallback to execute when the list is empty.
-
-
Constructor Details
-
AbstractListValueCondition
-
AbstractListValueCondition
Deprecated.in favor of the statement configuration functionsConstruct a new condition with a callback.- Parameters:
values
- valuesemptyCallback
- empty callback
-
-
Method Details
-
mapValues
-
shouldRender
public boolean shouldRender()Description copied from interface:VisitableCondition
Subclasses can override this to inform the renderer if the condition should not be included in the rendered SQL. For example, IsEqualWhenPresent will not render if the value is null.- Specified by:
shouldRender
in interfaceVisitableCondition<T>
- Returns:
- true if the condition should render.
-
renderingSkipped
public void renderingSkipped()Description copied from interface:VisitableCondition
This method will be called during rendering whenVisitableCondition.shouldRender()
returns false.- Specified by:
renderingSkipped
in interfaceVisitableCondition<T>
-
accept
- Specified by:
accept
in interfaceVisitableCondition<T>
-
filterSupport
protected <S extends AbstractListValueCondition<T>> S filterSupport(Predicate<? super T> predicate, BiFunction<Collection<T>, Callback, S> constructor, S self, Supplier<S> emptySupplier) -
mapSupport
protected <R,S extends AbstractListValueCondition<R>> S mapSupport(Function<? super T, ? extends R> mapper, BiFunction<Collection<R>, Callback, S> constructor, Supplier<S> emptySupplier) -
filter
If renderable, apply the predicate to each value in the list and return a new condition with the filtered values. Else returns a condition that will not render (this). If all values are filtered out of the value list, then the condition will not render.- Parameters:
predicate
- predicate applied to the values, if renderable- Returns:
- a new condition with filtered values if renderable, otherwise a condition that will not render.
-
withListEmptyCallback
Deprecated.in favor of the statement configuration functionsSpecifies a callback function to be called if the value list is empty when rendered.- Parameters:
callback
- a callback function - typically throws an exception to block the statement from executing- Returns:
- this condition
-
renderCondition
-