@Test public void defaultIfNullFunctionTest() throws Exception { Function f = (Function) ECQL.toExpression("DefaultIfNull('#FF0000', '#000000')"); assertEquals(Color.RED, f.evaluate(null, Color.class)); f = ff.function("DefaultIfNull", ff.literal(null), ff.literal("#000000")); assertEquals(Color.BLACK, f.evaluate(null, Color.class)); SimpleFeatureType SAMPLE = DataUtilities.createType("SAMPLE", "id:\"\",temperature:0.0,location=4326"); SimpleFeature feature = DataUtilities.createFeature(SAMPLE, "measure1=A|NOT_A_VALID_NUMBER|POINT(0,0)"); f = ff.function("DefaultIfNull", ff.property("temperature"), ff.literal(789)); assertEquals(789, f.evaluate(feature, Number.class).intValue()); Function exp = ff.function( "Exponential", ff.property("temperature"), ff.literal(1), ff.literal(0), ff.literal("#000000"), ff.literal(10), ff.literal("#ffffff")); f = ff.function("DefaultIfNull", exp, ff.literal(789)); assertEquals(789, f.evaluate(feature, Number.class)); Function recode = ff.function( "Recode", ff.property("temperature"), ff.literal(1), ff.literal("Output1"), ff.literal(2), ff.literal("Output2")); f = ff.function("DefaultIfNull", recode, ff.literal("DefautValue")); assertEquals("DefautValue", f.evaluate(feature, String.class)); }
@Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); } }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  @Override List<FunctionName> getFunctionNames(); @Override Function function(String name, List<Expression> args, Literal fallback); @Override Function function(Name name, List<Expression> args, Literal fallback); }
MBFunctionFactory implements FunctionFactory { @Override public Function function(String name, List<Expression> args, Literal fallback) { return function(new NameImpl(name), args, fallback); }  @Override List<FunctionName> getFunctionNames(); @Override Function function(String name, List<Expression> args, Literal fallback); @Override Function function(Name name, List<Expression> args, Literal fallback);  }