@Test public void testConvertsJavaObjectToString() throws Exception { final StringRhsFunction f = new StringRhsFunction(); final File o = new File("/path/to/something"); final Symbol result = f.execute(rhsFuncContext, Symbols.asList(syms, o)); assertEquals(o.toString() +" ("+o.getClass().getName()+")", result.asString().getValue()); }
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments);  }