@Test public void testDoesNotMatchIfNotArray() throws Exception { FilterFactoryImpl ff = new FilterFactoryImpl(); Function func = ff.function("inArray", ff.literal("a"), ff.literal("g")); assertFalse((Boolean) func.evaluate(new Object())); }
public Object evaluate(Object feature) { Object candidate = getExpression(0).evaluate(feature); Object[] array = getExpression(1).evaluate(feature, Object[].class); if (candidate == null || array == null) { return Boolean.FALSE; } return Boolean.valueOf(Arrays.asList(array).contains(candidate)); }
InArrayFunction extends FunctionExpressionImpl { public Object evaluate(Object feature) { Object candidate = getExpression(0).evaluate(feature); Object[] array = getExpression(1).evaluate(feature, Object[].class); if (candidate == null || array == null) { return Boolean.FALSE; } return Boolean.valueOf(Arrays.asList(array).contains(candidate)); } }
InArrayFunction extends FunctionExpressionImpl { public Object evaluate(Object feature) { Object candidate = getExpression(0).evaluate(feature); Object[] array = getExpression(1).evaluate(feature, Object[].class); if (candidate == null || array == null) { return Boolean.FALSE; } return Boolean.valueOf(Arrays.asList(array).contains(candidate)); } InArrayFunction(); }
InArrayFunction extends FunctionExpressionImpl { public Object evaluate(Object feature) { Object candidate = getExpression(0).evaluate(feature); Object[] array = getExpression(1).evaluate(feature, Object[].class); if (candidate == null || array == null) { return Boolean.FALSE; } return Boolean.valueOf(Arrays.asList(array).contains(candidate)); } InArrayFunction(); Object evaluate(Object feature); }
InArrayFunction extends FunctionExpressionImpl { public Object evaluate(Object feature) { Object candidate = getExpression(0).evaluate(feature); Object[] array = getExpression(1).evaluate(feature, Object[].class); if (candidate == null || array == null) { return Boolean.FALSE; } return Boolean.valueOf(Arrays.asList(array).contains(candidate)); } InArrayFunction(); Object evaluate(Object feature); static FunctionName NAME; }