@Test public void testISEMPTY() throws Exception { Expression action = new Expression(); action.setExpression("IF(ISEMPTY(${0}), 'empty', 'not empty')"); assertEquals("empty", ExpressionFieldAction.process(action, Arrays.asList((Object)null))); assertEquals("empty", ExpressionFieldAction.process(action, Arrays.asList(""))); assertEquals("not empty", ExpressionFieldAction.process(action, Arrays.asList(" "))); }
@AtlasActionProcessor public static Object process(io.atlasmap.v2.Expression action, List<Object> args) throws ExpressionException { if (action.getExpression() == null || action.getExpression().trim().isEmpty()) { return null; } Expression parsedExpression = Expression.parse(action.getExpression(), DefaultAtlasFunctionResolver.getInstance()); Field answer = parsedExpression.evaluate((index) -> { try { return wrapWithField(args.get(Integer.parseInt(index))); } catch (Throwable e) { throw new ExpressionException("Invalid variable: " + index); } }); return unwrapField(answer); }
ExpressionFieldAction implements AtlasFieldAction { @AtlasActionProcessor public static Object process(io.atlasmap.v2.Expression action, List<Object> args) throws ExpressionException { if (action.getExpression() == null || action.getExpression().trim().isEmpty()) { return null; } Expression parsedExpression = Expression.parse(action.getExpression(), DefaultAtlasFunctionResolver.getInstance()); Field answer = parsedExpression.evaluate((index) -> { try { return wrapWithField(args.get(Integer.parseInt(index))); } catch (Throwable e) { throw new ExpressionException("Invalid variable: " + index); } }); return unwrapField(answer); } }
ExpressionFieldAction implements AtlasFieldAction { @AtlasActionProcessor public static Object process(io.atlasmap.v2.Expression action, List<Object> args) throws ExpressionException { if (action.getExpression() == null || action.getExpression().trim().isEmpty()) { return null; } Expression parsedExpression = Expression.parse(action.getExpression(), DefaultAtlasFunctionResolver.getInstance()); Field answer = parsedExpression.evaluate((index) -> { try { return wrapWithField(args.get(Integer.parseInt(index))); } catch (Throwable e) { throw new ExpressionException("Invalid variable: " + index); } }); return unwrapField(answer); }  }
ExpressionFieldAction implements AtlasFieldAction { @AtlasActionProcessor public static Object process(io.atlasmap.v2.Expression action, List<Object> args) throws ExpressionException { if (action.getExpression() == null || action.getExpression().trim().isEmpty()) { return null; } Expression parsedExpression = Expression.parse(action.getExpression(), DefaultAtlasFunctionResolver.getInstance()); Field answer = parsedExpression.evaluate((index) -> { try { return wrapWithField(args.get(Integer.parseInt(index))); } catch (Throwable e) { throw new ExpressionException("Invalid variable: " + index); } }); return unwrapField(answer); }  @AtlasActionProcessor static Object process(io.atlasmap.v2.Expression action, List<Object> args); }
ExpressionFieldAction implements AtlasFieldAction { @AtlasActionProcessor public static Object process(io.atlasmap.v2.Expression action, List<Object> args) throws ExpressionException { if (action.getExpression() == null || action.getExpression().trim().isEmpty()) { return null; } Expression parsedExpression = Expression.parse(action.getExpression(), DefaultAtlasFunctionResolver.getInstance()); Field answer = parsedExpression.evaluate((index) -> { try { return wrapWithField(args.get(Integer.parseInt(index))); } catch (Throwable e) { throw new ExpressionException("Invalid variable: " + index); } }); return unwrapField(answer); }  @AtlasActionProcessor static Object process(io.atlasmap.v2.Expression action, List<Object> args);  }