@Override public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException { if (base instanceof WebApplicationContext) { elContext.setPropertyResolved(true); return true; } return false; }
@Override protected void invoke() { valueExpression.setValue(elContext, value); }
/** * {@inheritDoc} */ @Override public <T> void setVariable(String key, T value, Class<? extends T> type) { ValueExpression valueExpression = expressionFactory.createValueExpression(value, type); VariableMapper variableMapper = elContext.getVariableMapper(); variableMapper.setVariable(key, valueExpression); }
@Override protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver compositeElResolver = new CompositeELResolver(); compositeElResolver.add(new VariableScopeElResolver(variableScope)); compositeElResolver.add(new MockElResolver()); compositeElResolver.add(new ArrayELResolver()); compositeElResolver.add(new ListELResolver()); compositeElResolver.add(new MapELResolver()); compositeElResolver.add(new BeanELResolver()); return compositeElResolver; }
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); } }
protected void invoke() { invocationResult = valueExpression.getValue(elContext); }
@Override public ELResolver getELResolver() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new ResponseContextResolver(entity, resource, instance)); resolver.add(new BeanELResolver(true)); return resolver; }
@Override public void setValue(ELContext elContext, @Nullable Object base, Object property, Object value) throws ELException { if (base == null) { String beanName = property.toString(); WebApplicationContext wac = getWebApplicationContext(elContext); if (wac.containsBean(beanName)) { if (value == wac.getBean(beanName)) { // Setting the bean reference to the same value is alright - can simply be ignored... elContext.setPropertyResolved(true); } else { throw new PropertyNotWritableException( "Variable '" + beanName + "' refers to a Spring bean which by definition is not writable"); } } } }
/** * Assign a ValueExpression to an EL variable, replacing * any previous assignment to the same variable. * The assignment for the variable is removed if * the expression is <code>null</code>. * * @param variable The variable name * @param expression The ValueExpression to be assigned * to the variable. */ public void setVariable(String variable, ValueExpression expression) { getELContext().getVariableMapper().setVariable(variable, expression); }
/** * {@inheritDoc} */ @Override public void setFunction(String prefix, String name, Method method) { FunctionMapper functions = elContext.getFunctionMapper(); functions.mapFunction(prefix, name, method); }
/** * Maps a static method to an EL function. * @param prefix The namespace of the functions, can be "". * @param function The name of the function. * @param meth The static method to be invoked when the function is used. */ public void mapFunction(String prefix, String function, Method meth) { getELContext().getFunctionMapper().mapFunction(prefix, function, meth); }
/** * Register a BeanNameResolver. * Construct a BeanNameELResolver with the BeanNameResolver and add it * to the list of ELResolvers. * Once registered, the BeanNameResolver cannot be removed. * @param bnr The BeanNameResolver to be registered. */ public void addBeanNameResolver(BeanNameResolver bnr) { getELContext().addELResolver(new BeanNameELResolver(bnr)); }
/** * Import a class. The imported class must be loadable from the classloader * at the expression evaluation time. * @param className The full class name of the class to be imported * @throws ELException if the name is not a full class name. */ public void importClass(String className) throws ELException { getELContext().getImportHandler().importClass(className); }
/** * Import a package. At the expression evaluation time, the imported package * name will be used to construct the full class name, which will then be * used to load the class. Inherently, this is less efficient than * importing a class. * @param packageName The package name to be imported */ public void importPackage(String packageName) { getELContext().getImportHandler().importPackage(packageName); }
/** * Import a static field or method. The class of the static member must be * loadable from the classloader, at class resolution time. * @param staticMemberName The full class name of the class to be imported * @throws ELException if the name is not a full class name. */ public void importStatic(String staticMemberName) throws ELException { getELContext().getImportHandler().importStatic(staticMemberName); }
/** * Notifies the listeners before an EL expression is evaluated * @param expr The EL expression string to be evaluated */ public void notifyBeforeEvaluation(String expr) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.beforeEvaluation(this, expr); } }
/** * Notifies the listeners when the (base, property) pair is resolved * @param base The base object * @param property The property Object */ public void notifyPropertyResolved(Object base, Object property) { if (getEvaluationListeners() == null) return; for (EvaluationListener listener: getEvaluationListeners()) { listener.propertyResolved(this, base, property); } }
private ELResolver createElResolver() { CompositeELResolver compositeResolver = new CompositeELResolver(); compositeResolver.add(new ArrayELResolver()); compositeResolver.add(new ListELResolver()); compositeResolver.add(new MapELResolver()); compositeResolver.add(new JsonNodeELResolver()); compositeResolver.add(new ResourceBundleELResolver()); compositeResolver.add(new DynamicBeanPropertyELResolver(ItemInstance.class, "getFieldValue", "setFieldValue")); compositeResolver.add(new BeanELResolver()); return new SimpleResolver(compositeResolver); }
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); } }
@Override public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException { if (base instanceof WebApplicationContext) { elContext.setPropertyResolved(true); return true; } return false; }