- java.lang.Object
-
- org.mybatis.dynamic.sql.AbstractListValueCondition<T>
-
- All Implemented Interfaces:
VisitableCondition<T>
- Direct Known Subclasses:
IsIn,IsInCaseInsensitive,IsNotIn,IsNotInCaseInsensitive
public abstract class AbstractListValueCondition<T> extends Object implements VisitableCondition<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected CallbackemptyCallbackprotected Collection<T>values
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractListValueCondition(Collection<T> values)protectedAbstractListValueCondition(Collection<T> values, Callback emptyCallback)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <R> Raccept(ConditionVisitor<T,R> visitor)abstract AbstractListValueCondition<T>filter(Predicate<? super T> predicate)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)<R> Stream<R>mapValues(Function<T,R> mapper)abstract StringrenderCondition(String columnName, Stream<String> placeholders)voidrenderingSkipped()This method will be called during rendering whenVisitableCondition.shouldRender()returns false.booleanshouldRender()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)
-
-
-
Field Detail
-
values
protected final Collection<T> values
-
emptyCallback
protected final Callback emptyCallback
-
-
Constructor Detail
-
AbstractListValueCondition
protected AbstractListValueCondition(Collection<T> values)
-
AbstractListValueCondition
protected AbstractListValueCondition(Collection<T> values, Callback emptyCallback)
-
-
Method Detail
-
shouldRender
public boolean shouldRender()
Description copied from interface:VisitableConditionSubclasses 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:
shouldRenderin interfaceVisitableCondition<T>- Returns:
- true if the condition should render.
-
renderingSkipped
public void renderingSkipped()
Description copied from interface:VisitableConditionThis method will be called during rendering whenVisitableCondition.shouldRender()returns false.- Specified by:
renderingSkippedin interfaceVisitableCondition<T>
-
accept
public <R> R accept(ConditionVisitor<T,R> visitor)
- Specified by:
acceptin 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
public abstract AbstractListValueCondition<T> filter(Predicate<? super T> predicate)
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
public abstract AbstractListValueCondition<T> withListEmptyCallback(Callback callback)
-
-