Examples of OgnlContext


Examples of ognl.OgnlContext

        try {
            PropertyEditor e = getPropertyEditor(
                    getParent(aname).getClass(),
                    pdesc.getName(), pdesc.getPropertyType());
            e.setAsText((String) avalue);
            OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source);
            ctx.setTypeConverter(typeConverter);
            Ognl.setValue(aname, ctx, source, e.getValue());
        } catch (Throwable e) {
            throwMBeanException(e);
        }
    }
View Full Code Here

Examples of ognl.OgnlContext

        return Class.forName(signature);
    }

    private Object getAttribute(Object object, String fqan, Class<?> attrType) throws OgnlException {
        Object property;
        OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(object);
        ctx.setTypeConverter(new OgnlTypeConverter());
        if (attrType == null) {
            property = Ognl.getValue(fqan, ctx, object);
        } else {
            property = Ognl.getValue(fqan, ctx, object, attrType);
        }
View Full Code Here

Examples of ognl.OgnlContext

    public static OgnlExpression ognl(String expression) {
        return new OgnlExpression(new OgnlLanguage(), expression, Object.class);
    }

    public <T> T evaluate(Exchange exchange, Class<T> tClass) {
        OgnlContext oglContext = new OgnlContext();
        // setup the class resolver from camel
        oglContext.setClassResolver(new CamelClassResolver(exchange.getContext().getClassResolver()));
        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 Object evaluate(Exchange exchange) {
        // 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 {
            return Ognl.getValue(expression, oglContext, new RootObject(exchange));
        } catch (OgnlException e) {
            throw new ExpressionEvaluationException(this, exchange, e);
        }
View Full Code Here

Examples of ognl.OgnlContext

    }

    private boolean isEvalExpression(Object tree, Map<String, Object> context) throws OgnlException {
        if (tree instanceof SimpleNode) {
            SimpleNode node = (SimpleNode) tree;
            OgnlContext ognlContext = null;

            if (context!=null && context instanceof OgnlContext) {
                ognlContext = (OgnlContext) context;
            }
            return node.isEvalChain(ognlContext);
View Full Code Here

Examples of ognl.OgnlContext

            throw new NullPointerException("sessions");
        }
       
        Set<IoSession> answer = new LinkedHashSet<IoSession>();
        for (IoSession s: sessions) {
            OgnlContext context = (OgnlContext) Ognl.createDefaultContext(s);
            context.setTypeConverter(typeConverter);
            context.put(AbstractPropertyAccessor.READ_ONLY_MODE, true);
            context.put(AbstractPropertyAccessor.QUERY, query);
            Object result = Ognl.getValue(expression, context, s);
            if (result instanceof Boolean) {
                if (((Boolean) result).booleanValue()) {
                    answer.add(s);
                }
View Full Code Here

Examples of ognl.OgnlContext

        }

        if (attrName == null) {
            // I don't know why but OGNL gives null attrName almost always.
            // Fortunately, we can get the actual attrName with a tiny hack.
            OgnlContext ognlCtx = (OgnlContext) ctx;
            attrName = ognlCtx.getCurrentNode().toString().replaceAll(
                    "[\" \']+", "");
        }

        if (toType.isAssignableFrom(value.getClass())) {
            return value;
View Full Code Here

Examples of ognl.OgnlContext

        try {
            PropertyEditor e = getPropertyEditor(
                    getParent(aname).getClass(),
                    pdesc.getName(), pdesc.getPropertyType());
            e.setAsText((String) avalue);
            OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(source);
            ctx.setTypeConverter(typeConverter);
            Ognl.setValue(aname, ctx, source, e.getValue());
        } catch (Throwable e) {
            throwMBeanException(e);
        }
    }
View Full Code Here

Examples of ognl.OgnlContext

        return Class.forName(signature);
    }

    private Object getAttribute(Object object, String fqan, Class<?> attrType) throws OgnlException {
        Object property;
        OgnlContext ctx = (OgnlContext) Ognl.createDefaultContext(object);
        ctx.setTypeConverter(new OgnlTypeConverter());
        if (attrType == null) {
            property = Ognl.getValue(fqan, ctx, object);
        } else {
            property = Ognl.getValue(fqan, ctx, object, attrType);
        }
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.