public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
public static Accessor extractAccessor(ASTNode n) { if (n instanceof LiteralNode) return new ExecutableLiteral(n.getLiteralValue()); else return new ExecutableAccessor(n, n.getEgressType()); }
public ExprValueAccessor(String ex, Class expectedType, Object ctx, VariableResolverFactory factory, ParserContext pCtx) { stmt = (ExecutableStatement) ParseTools.subCompileExpression(ex.toCharArray(), pCtx); //if (expectedType.isArray()) { Class tt = getSubComponentType(expectedType); Class et = stmt.getKnownEgressType(); if (stmt.getKnownEgressType() != null && !tt.isAssignableFrom(et)) { if ((stmt instanceof ExecutableLiteral) && canConvert(et, tt)) { try { stmt = new ExecutableLiteral(convert(stmt.getValue(ctx, factory), tt)); return; } catch (IllegalArgumentException e) { // fall through; } } if (pCtx != null && pCtx.isStrongTyping()) throw new CompileException("was expecting type: " + tt + "; but found type: " + (et == null ? "null" : et.getName())); } }
public ExprValueAccessor(String ex, Class expectedType, Object ctx, VariableResolverFactory factory, ParserContext pCtx) { stmt = (ExecutableStatement) ParseTools.subCompileExpression(ex.toCharArray(), pCtx); //if (expectedType.isArray()) { Class tt = getSubComponentType(expectedType); Class et = stmt.getKnownEgressType(); if (stmt.getKnownEgressType() != null && !isAssignableFrom(tt, et)) { if ((stmt instanceof ExecutableLiteral) && canConvert(et, tt)) { try { stmt = new ExecutableLiteral(convert(stmt.getValue(ctx, factory), tt)); return; } catch (IllegalArgumentException e) { // fall through; } } if (pCtx != null && pCtx.isStrongTyping()) throw new RuntimeException("was expecting type: " + tt + "; but found type: " + (et == null ? "null" : et.getName())); } }
public ExprValueAccessor(String ex, Class expectedType, Object ctx, VariableResolverFactory factory, ParserContext pCtx) { stmt = (ExecutableStatement) ParseTools.subCompileExpression(ex.toCharArray(), pCtx); //if (expectedType.isArray()) { Class tt = getSubComponentType(expectedType); Class et = stmt.getKnownEgressType(); if (stmt.getKnownEgressType() != null && !isAssignableFrom(tt, et)) { if ((stmt instanceof ExecutableLiteral) && canConvert(et, tt)) { try { stmt = new ExecutableLiteral(convert(stmt.getValue(ctx, factory), tt)); return; } catch (IllegalArgumentException e) { // fall through; } } if (pCtx != null && pCtx.isStrongTyping()) throw new RuntimeException("was expecting type: " + tt + "; but found type: " + (et == null ? "null" : et.getName())); } }
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
private static Serializable _optimizeTree(final CompiledExpression compiled) { /** * If there is only one token, and it's an identifier, we can optimize this as an accessor expression. */ if (compiled.isSingleNode()) { ASTNode tk = compiled.getFirstNode(); if (tk.isLiteral() && !tk.isThisVal()) { return new ExecutableLiteral(tk.getLiteralValue()); } return tk.canSerializeAccessor() ? new ExecutableAccessorSafe(tk, compiled.getKnownEgressType()) : new ExecutableAccessor(tk, compiled.getKnownEgressType()); } return compiled; }
System.arraycopy(es,0,executableStatements,0,es.length); executableStatements[executableStatements.length -1 ]= new ExecutableLiteral(Array.newInstance(aClass,0)); es = executableStatements;
System.arraycopy(es,0,executableStatements,0,es.length); executableStatements[executableStatements.length -1 ]= new ExecutableLiteral(Array.newInstance(aClass,0)); es = executableStatements;
a.setValueStatement(new ExecutableLiteral(convert(c.getValue(null, null), returnType))); return tk;
a.setValueStatement(new ExecutableLiteral(convert(c.getValue(null, null), returnType))); return tk;
a.setValueStatement(new ExecutableLiteral(convert(c.getValue(null, null), returnType))); return tk;