Package org.mvel2.integration

Examples of org.mvel2.integration.VariableResolver


    this.register = register;
    this.egressType = pCtx.getVarOrInputType(pCtx.getIndexedVarNames()[register]);
  }

  public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
    VariableResolver vResolver = factory.getIndexedVariableResolver(register);
    //  ctx = vResolver.getValue();
    vResolver.setValue(MathProcessor.doOperations(ParseTools.resolveType(ctx = vResolver.getValue()),
        ctx, Operator.SUB, DataTypes.INTEGER, 1));
    return ctx;
  }
View Full Code Here


        Map<String, Object> sessionScope = new HashMap<String, Object>();
        sessionScope.put("three", "three");
        expect(request.getSessionScope()).andReturn(sessionScope).anyTimes();
        replay(request, applicationContext);

        VariableResolver resolver = factory.getVariableResolver("one");
        assertEquals(1, resolver.getValue());
        resolver = factory.getVariableResolver("two");
        assertEquals(2, resolver.getValue());
        resolver = factory.getVariableResolver("three");
        assertEquals("three", resolver.getValue());
        verify(request, applicationContext);
    }
View Full Code Here

        applicationScope.put("two", 2);
        expect(request.getApplicationContext()).andReturn(applicationContext);
        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
        replay(request, applicationContext);

        VariableResolver resolver = factory.getVariableResolver("requestScope");
        assertEquals(requestScope, resolver.getValue());
        resolver = factory.getVariableResolver("applicationScope");
        assertEquals(applicationScope, resolver.getValue());
    }
View Full Code Here

    public VariableResolver getVariableResolver(String name) {
        if (isResolveable(name)) {
            if (variableResolvers != null && variableResolvers.containsKey(name)) {
                return variableResolvers.get(name);
            } else if (isTarget(name)) {
                VariableResolver variableResolver = new TilesContextBeanVariableResolver(name);
                variableResolvers.put(name, variableResolver);
                return variableResolver;
            } else if (nextFactory != null) {
                return nextFactory.getVariableResolver(name);
            }
View Full Code Here

        Map<String, Object> sessionScope = new HashMap<String, Object>();
        sessionScope.put("three", "three");
        expect(request.getSessionScope()).andReturn(sessionScope).anyTimes();
        replay(request, applicationContext);

        VariableResolver resolver = factory.getVariableResolver("one");
        assertEquals(1, resolver.getValue());
        resolver = factory.getVariableResolver("two");
        assertEquals(2, resolver.getValue());
        resolver = factory.getVariableResolver("three");
        assertEquals("three", resolver.getValue());
        verify(request, applicationContext);
    }
View Full Code Here

        applicationScope.put("two", 2);
        expect(request.getApplicationContext()).andReturn(applicationContext);
        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
        replay(request, applicationContext);

        VariableResolver resolver = factory.getVariableResolver("requestScope");
        assertEquals(requestScope, resolver.getValue());
        resolver = factory.getVariableResolver("applicationScope");
        assertEquals(applicationScope, resolver.getValue());
    }
View Full Code Here

        this.localVariables.put(identifier,
                value);
    }
    public VariableResolver createVariable(String name, Object value) {
        VariableResolver vr;
        try {
            vr = getVariableResolver(name);
        }
        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name), value);
        }
    }
View Full Code Here

    public VariableResolver createVariable(String name,
                                           Object value,
                                           Class type) {
        VariableResolver vr;
        try {
            vr = getVariableResolver(name);
        }
        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name, type), value);
        }
View Full Code Here

    public VariableResolver createVariable(String name,
                                           Object value,
                                           Class type) {
        VariableResolver vr;
        try {
            vr = getVariableResolver(name);
        }
        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name, type), value);
        }
View Full Code Here

        this.localVariables.put(identifier,
                value);
    }
    public VariableResolver createVariable(String name, Object value) {
        VariableResolver vr;
        try {
            vr = getVariableResolver(name);
        }
        catch (UnresolveablePropertyException e) {
            vr = null;
        }
        if (vr != null && vr.getType() != null) {
            throw new CompileException("variable already defined within scope: " + vr.getType() + " " + name);
        }
        else {
            return addResolver(name, new LocalVariableResolver(this, name), value);
        }
    }
View Full Code Here

TOP

Related Classes of org.mvel2.integration.VariableResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.