Examples of OgnlContext


Examples of ognl.OgnlContext

    try {
      root = type.getDeclaredConstructor().newInstance();
    } catch (Exception ex) {
      throw new InvalidParameterException("unable to instantiate type" + type.getName(), ex);
    }
    OgnlContext context = (OgnlContext) Ognl.createDefaultContext(root);
    context.setTraceEvaluations(true);
    context.put(Container.class, this.container);

    VRaptorConvertersAdapter adapter = new VRaptorConvertersAdapter(converters, bundle);
    Ognl.setTypeConverter(context, adapter);
    for (Enumeration<?> enumeration = request.getParameterNames(); enumeration.hasMoreElements();) {
      String key = (String) enumeration.nextElement();
View Full Code Here

Examples of ognl.OgnlContext

    }
    if (value instanceof String) {
      // it might be that suckable ognl did not call convert, i.e.: on the
      // values[i] = 2l in a List<Long>.
      // we all just looooove ognl.
      OgnlContext ctx = (OgnlContext) context;
      // if direct injecting, cannot find out what to do, use string
      if (ctx.getRoot() != target) {
        Evaluation eval = ctx.getCurrentEvaluation();
        Evaluation previous = eval.getPrevious();
        String fieldName = previous.getNode().toString();
        Object origin = previous.getSource();
        Method getter = ReflectionBasedNullHandler.findMethod(origin.getClass(), "get"
            + Info.capitalize(fieldName), origin.getClass(), null);
View Full Code Here

Examples of ognl.OgnlContext

    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceAccessor() {
        NestedObjectExtractor<Integer> nestedObjectExtractor = createMock(NestedObjectExtractor.class);
        PropertyAccessor propertyAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(propertyAccessor.getSourceAccessor(context, "nested", "property")).andReturn("method");
        expect(nestedObjectExtractor.getNestedObject(1)).andReturn("nested");

        replay(nestedObjectExtractor, propertyAccessor, context);
        PropertyAccessor accessor = new NestedObjectDelegatePropertyAccessor<Integer>(
View Full Code Here

Examples of ognl.OgnlContext

    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceSetter() {
        NestedObjectExtractor<Integer> nestedObjectExtractor = createMock(NestedObjectExtractor.class);
        PropertyAccessor propertyAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(propertyAccessor.getSourceSetter(context, "nested", "property")).andReturn("method");
        expect(nestedObjectExtractor.getNestedObject(1)).andReturn("nested");

        replay(nestedObjectExtractor, propertyAccessor, context);
        PropertyAccessor accessor = new NestedObjectDelegatePropertyAccessor<Integer>(
View Full Code Here

Examples of ognl.OgnlContext

    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceAccessor() {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        expect(mockAccessor.getSourceAccessor(context, 1, "property")).andReturn("method");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
View Full Code Here

Examples of ognl.OgnlContext

    @SuppressWarnings("unchecked")
    @Test
    public void testGetSourceSetter() {
        PropertyAccessorDelegateFactory<Integer> factory = createMock(PropertyAccessorDelegateFactory.class);
        PropertyAccessor mockAccessor = createMock(PropertyAccessor.class);
        OgnlContext context = createMock(OgnlContext.class);
        expect(factory.getPropertyAccessor("property", 1)).andReturn(mockAccessor);
        expect(mockAccessor.getSourceSetter(context, 1, "property")).andReturn("method");

        replay(factory, mockAccessor, context);
        PropertyAccessor accessor = new DelegatePropertyAccessor<Integer>(factory);
View Full Code Here

Examples of ognl.OgnlContext

    }

    public <T> T evaluate(Exchange exchange, Class<T> tClass) {
        // TODO we could use caching here but then we'd have possible
        // concurrency issues so lets assume that the provider caches
        OgnlContext oglContext = new OgnlContext();
        try {
            Object value = Ognl.getValue(expression, oglContext, new RootObject(exchange));
            return exchange.getContext().getTypeConverter().convertTo(tClass, value);
        } catch (OgnlException e) {
            throw new ExpressionEvaluationException(this, exchange, e);
View Full Code Here

Examples of ognl.OgnlContext

    }

    public <T> T evaluate(Exchange exchange, Class<T> tClass) {
        // TODO we could use caching here but then we'd have possible
        // concurrency issues so lets assume that the provider caches
        OgnlContext oglContext = new OgnlContext();
        try {
            Object value = Ognl.getValue(expression, oglContext, new RootObject(exchange));
            return exchange.getContext().getTypeConverter().convertTo(tClass, value);
        } catch (OgnlException e) {
            throw new ExpressionEvaluationException(this, exchange, e);
View Full Code Here

Examples of ognl.OgnlContext

        if (debug) {
            log.debug("Evaluating expression: " + expression);
        }

        // Object root;
        OgnlContext context = new OgnlContext(vars);

        Object expr = Ognl.parseExpression(expression);
        Object result = Ognl.getValue(expr, context);
       
        if (debug) {
View Full Code Here

Examples of ognl.OgnlContext

        if (debug) {
            log.debug("Evaluating expression: " + expression);
        }

        // Object root;
        OgnlContext context = new OgnlContext(vars);

        Object expr = Ognl.parseExpression(expression);
        Object result = Ognl.getValue(expr, context);
       
        if (debug) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.