public Method resolveFunction(String prefix, String name) { if (_mapper != null) { final Function f = _mapper.resolveFunction(prefix, name); if (f != null) return f.toMethod(); } return null; } }
/** Returns the expression factory. */ protected ExpressionFactory getExpressionFactory() { if (_expf == null) _expf = Expressions.newExpressionFactory(_expfcls); return _expf; }
/** Returns the implementation of the expression factory that * is used by the whole system, or null if the sytem default is used. * * @see #setExpressionFactoryClass * @since 3.0.0 */ public Class<? extends ExpressionFactory> getExpressionFactoryClass() { return Expressions.getExpressionFactoryClass(); }
public Object resolve(XelContext ctx, Object base, Object name) { Object o = ctx.getVariableResolver(); return (o instanceof VariableResolverX) ? ((VariableResolverX)o).resolveVariable(ctx, base, name): o != null && base == null && name != null ? ((VariableResolver)o).resolveVariable(name.toString()): null; } };
private Context(String content, XelContext xelc, Locator loc) { this.content = content; _resolver = xelc != null ? xelc.getVariableResolver() : null; _mapper = new SimpleMapper(xelc != null ? xelc.getFunctionMapper() : null); _xelf = Expressions.newExpressionFactory(); _locator = loc; this.nLines = 1; }
public Object resolveVariable(String name) throws XelException { if (_vars != null) { final Object o = _vars.get(name); if (o != null) return o; } return _parent instanceof VariableResolverX ? ((VariableResolverX)_parent).resolveVariable(null, null, name): _parent != null ? _parent.resolveVariable(name): null; } }
public Object getProperty(Map context, Object target, Object name) throws OgnlException { return target instanceof VariableResolver && name instanceof String ? ((VariableResolver)target).resolveVariable((String)name): null; } public void setProperty(Map context, Object target, Object name, Object value)
public Function resolveFunction(String prefix, String name) { Function m = _first != null ? _first.resolveFunction(prefix, name): null; return m != null ? m: _second != null ? _second.resolveFunction(prefix, name): null; } //-- FunctionMapperExt --//
/** Returns the root object. */ public static Object getRoot(XelContext ctx) { final VariableResolver resolver = ctx.getVariableResolver(); return resolver != null ? resolver: Expressions.EMPTY_RESOLVER; }
/** Evaluates an expression. * * @param ctx the context information to evaluate the expression * It can be null, in which case no functions are supported for this * invocation. * @param expression the expression to be evaluated. * Note: the expression is enclosed * with ${ and }, regardless of what implementation is used. * @param expectedType the expected type of the result of the evaluation */ public static final Object evaluate(XelContext ctx, String expression, Class<?> expectedType) throws XelException { return newExpressionFactory().evaluate(ctx, expression, expectedType); }
public String getValue() { return _expr != null ? (String)_expr.evaluate(_xelc): _val; } }
public Class<?> resolveClass(String name) { Class<?> m = _first instanceof FunctionMapperExt ? ((FunctionMapperExt)_first).resolveClass(name): null; return m != null ? m: _second instanceof FunctionMapperExt ? ((FunctionMapperExt)_second).resolveClass(name): null; } private static final <T> Collection<T> combine(Collection<T> first, Collection<T> second) {
public Object setAttribute(String name, Object value) { return _ctx.setAttribute(name, value); } public boolean hasAttribute(String name) {
public boolean hasAttribute(String name) { return _ctx.hasAttribute(name); } public Object removeAttribute(String name) {
public Map<String, Object> getAttributes() { return _ctx.getAttributes(); } }
public Method resolveFunction(String prefix, String name) { if (_mapper != null) { final Function f = _mapper.resolveFunction(prefix, name); if (f != null) return f.toMethod(); } return null; } }
public VariableResolver getVariableResolver() { return _bResolver ? _resolver: _ctx.getVariableResolver(); } public FunctionMapper getFunctionMapper() {
private ExpressionFactory getExpressionFactory() { if (_expf == null) _expf = Expressions.newExpressionFactory(); //TODO: expfcls return _expf; } }
public Method resolveFunction(String prefix, String name) { if (_mapper != null) { final Function f = _mapper.resolveFunction(prefix, name); if (f != null) return f.toMethod(); } return null; } }
public Method resolveFunction(String prefix, String name) { if (_mapper != null) { final Function f = _mapper.resolveFunction(prefix, name); if (f != null) return f.toMethod(); } return null; } }