diff --git a/rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/ExpressionsTest.java b/rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/ExpressionsTest.java index 530a3b22..942bd247 100644 --- a/rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/ExpressionsTest.java +++ b/rxrepo-apt/src/test/java/com/slimgears/rxrepo/queries/ExpressionsTest.java @@ -8,6 +8,7 @@ import org.junit.Test; import java.util.Collections; +import java.util.List; import java.util.function.Function; import static com.slimgears.rxrepo.filters.ComparableFilter.fromGreaterOrEqual; @@ -108,4 +109,16 @@ public void testAnnotationRetrieval() { Assert.assertTrue(TestEntity.metaClass.number.hasAnnotation(Indexable.class)); Assert.assertFalse(TestEntity.metaClass.refEntity.hasAnnotation(Indexable.class)); } + + @Test + public void testValueInExpression() { + List strings = Collections.singletonList("Entity 1"); + Function exp = Expressions + .compile(TestEntity.$.text.in(strings)); + + Assert.assertTrue(exp.apply(testEntity1)); + Assert.assertFalse(exp.apply(testEntity2)); + } + + } diff --git a/rxrepo-core/src/main/java/com/slimgears/rxrepo/util/Expressions.java b/rxrepo-core/src/main/java/com/slimgears/rxrepo/util/Expressions.java index 02ef7df4..4a1865a5 100644 --- a/rxrepo-core/src/main/java/com/slimgears/rxrepo/util/Expressions.java +++ b/rxrepo-core/src/main/java/com/slimgears/rxrepo/util/Expressions.java @@ -97,6 +97,7 @@ private static class InternalVisitor extends ExpressionVisitor { .put(Expression.Type.Max, notSupported()) .put(Expression.Type.Sum, notSupported()) .put(Expression.Type.SearchText, Expressions.fromBinary((Object obj, String str) -> obj.toString().contains(str))) + .put(Expression.Type.ValueIn, Expressions.fromBinary((Object obj, Collection collection) -> collection.contains(obj))) .build(); private final static ImmutableMap> operationTypeReducersMap = ImmutableMap.>builder()