protected AstIdentifier createAstIdentifier(String name, int index) { return new AstIdentifier(name, index, context.isEnabled(Feature.IGNORE_RETURN_TYPE)); }
public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { return getMethodExpression(bindings, context, returnType, paramTypes).getMethodInfo(context); }
protected MethodExpression getMethodExpression(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { Object value = eval(bindings, context); if (value == null) { throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notfound", name)); final Method method = findAccessibleMethod((Method)value); if (method == null) { throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notfound", name));
@Override public Object eval(Bindings bindings, ELContext context) { Map<String, Object> resolved = new LinkedHashMap<>(); for (Map.Entry<AstNode, AstNode> entry : dict.entrySet()) { String key; if (entry.getKey() instanceof AstString) { key = Objects.toString(entry.getKey().eval(bindings, context)); } else if (entry.getKey() instanceof AstIdentifier) { key = ((AstIdentifier) entry.getKey()).getName(); } else { throw new TemplateStateException("Dict key must be a string or identifier, was: " + entry.getKey()); } resolved.put(key, entry.getValue().eval(bindings, context)); } return new PyMap(resolved); }
protected MethodExpression getMethodExpression(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { Object value = eval(bindings, context); if (value == null) { throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notfound", name)); final Method method = findAccessibleMethod((Method)value); if (method == null) { throw new MethodNotFoundException(LocalMessages.get("error.identifier.method.notfound", name));
@Override public Object eval(Bindings bindings, ELContext context) { return new NamedParameter(name.getName(), value.eval(bindings, context)); }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] params) { return getMethodExpression(bindings, context, returnType, paramTypes).invoke(context, params); }
protected AstIdentifier createAstIdentifier(String name, int index) { return new AstIdentifier(name, index, context.isEnabled(Feature.IGNORE_RETURN_TYPE)); }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] params) { return getMethodExpression(bindings, context, returnType, paramTypes).invoke(context, params); }
public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { return getMethodExpression(bindings, context, returnType, paramTypes).getMethodInfo(context); }