/** 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(); }
/** Sets the implementation of the expression factory that shall * be used by the whole system. * * <p>Default: null -- it means the org.zkoss.xel.el.ELFactory class * (it requires zcommons-el.jar). * * <p>Note: you can only specify an implementation that is compatible * with JSP EL here, since ZK's builtin pages depend on it. * However, you can use any factory you like in an individual page, * as long as all expressions in the page follow the syntax of * the evaluator you are using. * * @param expfcls the implemtation class, or null to use the default. * Note: expfcls must implement {@link ExpressionFactory}. * @since 3.0.0 */ public void setExpressionFactoryClass(Class<? extends ExpressionFactory> expfcls) { Expressions.setExpressionFactoryClass(expfcls); }
private ExpressionFactory getExpressionFactory() { if (_expf == null) _expf = Expressions.newExpressionFactory(); //TODO: expfcls return _expf; } }
private ExpressionFactory getExpressionFactory() { //TODO: how to make it depends on page's expf return Expressions.newExpressionFactory(); }
/** Instantiates an instance of {@link ExpressionFactory}. * * <p>The default class is {@link org.zkoss.xel.el.ELFactory}, * which supports EL 2.0. * If you run under JVM 1.5 or later and deploy * <a href="http://code.google.com/p/zel/">zel.jar</a> in your class * path, the default class is then {@link org.zkoss.xel.zel.ELFactory} * which supports EL 2.2. * To override it, you can specify the class by calling * {@link #setExpressionFactoryClass}, or use * {@link #newExpressionFactory(Class)} instead. * * <p>For the ZK user, you can override it with zk.xml * or org.zkoss.zk.ui.util.Configuration. * * @exception XelException if the specified class failed to load, * or instantiate. */ public static final ExpressionFactory newExpressionFactory() throws XelException { return newExpressionFactory(_expfcls); } /** Instantiates an instance of {@link ExpressionFactory}.
/** 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); }
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 LabelLoaderImpl() { _fmfilter = new FilterMap.Filter() { public Object filter(Object key, Object value) { Object o = value instanceof ExValue ? ((ExValue)value).getValue(): value; if (o == null) { // it's possible like missing a label. o = handleMissingLabel(key); } return o; } }; _expf = Expressions.newExpressionFactory(); _xelc = new SimpleXelContext(new Resolver(), null); }