Package ognl.enhance

Examples of ognl.enhance.UnsupportedCompilationException


        return "{^ " + _children[0] + " }";
    }
   
    public String toGetSourceString(OgnlContext context, Object target)
    {
        throw new UnsupportedCompilationException("Eval expressions not supported as native java yet.");
    }
View Full Code Here


        throw new UnsupportedCompilationException("Eval expressions not supported as native java yet.");
    }
   
    public String toSetSourceString(OgnlContext context, Object target)
    {
        throw new UnsupportedCompilationException("Eval expressions not supported as native java yet.");
    }
View Full Code Here

    }
   
    public String toSetSourceString(OgnlContext context, Object target)
    {
        if (_children.length != 2)
            throw new UnsupportedCompilationException("Can only compile boolean expressions with two children.");
       
        String pre = (String)context.get("_currentChain");
        if (pre == null)
            pre = "";
       
        String result = "";
       
        try {

            if (!OgnlOps.booleanValue(_children[0].getValue(context, target)))
            {
               throw new UnsupportedCompilationException("And expression can't be compiled until all conditions are true.");
            }
           
            String first = ExpressionCompiler.getRootExpression(_children[0], context.getRoot(), context)
            + pre + _children[0].toGetSourceString(context, target);
           
View Full Code Here

        } catch (NullPointerException e) {
           
            // expected to happen in some instances
            e.printStackTrace();
           
            throw new UnsupportedCompilationException("evaluation resulted in null expression.");
        } catch (Throwable t)
        {
            throw OgnlOps.castToRuntime(t);
        }
    }
View Full Code Here

        } catch (NullPointerException e) {
           
            // expected to happen in some instances
            e.printStackTrace();
           
            throw new UnsupportedCompilationException("evaluation resulted in null expression.");
        } catch (Throwable t)
        {
            throw OgnlOps.castToRuntime(t);
        }
    }
View Full Code Here

        }
    }
   
    public String toSetSourceString(OgnlContext context, Object target)
    {
        throw new UnsupportedCompilationException("Map expressions not supported as native java yet.");
    }
View Full Code Here

        return "{ " + _children[0] + " }";
    }
   
    public String toGetSourceString(OgnlContext context, Object target)
    {
        throw new UnsupportedCompilationException("Projection expressions not supported as native java yet.");
    }
View Full Code Here

        throw new UnsupportedCompilationException("Projection expressions not supported as native java yet.");
    }

    public String toSetSourceString(OgnlContext context, Object target)
    {
        throw new UnsupportedCompilationException("Projection expressions not supported as native java yet.");
    }
View Full Code Here

    public String toGetSourceString(OgnlContext context, Object target)
    {
        /*  System.out.println("methodName is " + _methodName + " for target " + target + " target class: " + (target != null ? target.getClass() : null)
  + " current type: " + context.getCurrentType());*/
        if (target == null)
            throw new UnsupportedCompilationException("Target object is null.");

        String post = "";
        String result = null;
        Method m = null;

        try {

            m = OgnlRuntime.getMethod(context, context.getCurrentType() != null ? context.getCurrentType() : target.getClass(), _methodName, _children, false);
            if (m == null)
                m = OgnlRuntime.getReadMethod(target.getClass(), _methodName, _children != null ? _children.length : -1);

            if (m == null) {
                m = OgnlRuntime.getWriteMethod(target.getClass(), _methodName, _children != null ? _children.length : -1);

                if (m != null) {

                    context.setCurrentType(m.getReturnType());
                    context.setCurrentAccessor(OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, m.getDeclaringClass()));

                    _coreExpression = toSetSourceString(context, target);
                    if (_coreExpression == null || _coreExpression.length() < 1)
                        throw new UnsupportedCompilationException("can't find suitable getter method");

                    _coreExpression +=  ";";
                    _lastExpression = "null";

                    return _coreExpression;
                }

                return "";
            } else {

                _getterClass = m.getReturnType();
            }

            // TODO:  This is a hacky workaround until javassist supports varargs method invocations

            boolean varArgs = OgnlRuntime.isJdk15() && m.isVarArgs();

            if (varArgs)
            {
                throw new UnsupportedCompilationException("Javassist does not currently support varargs method calls");
            }

            result = "." + m.getName() + "(";

            if ((_children != null) && (_children.length > 0))
View Full Code Here

        Method m = OgnlRuntime.getWriteMethod(context.getCurrentType() != null ?
                context.getCurrentType() : target.getClass(),
                                              _methodName, _children != null ? _children.length : -1);
        if (m == null)
        {
            throw new UnsupportedCompilationException("Unable to determine setter method generation for " + _methodName);
        }

        String post = "";
        String result = "." + m.getName() + "(";

        if (m.getReturnType() != void.class && m.getReturnType().isPrimitive()
            && (_parent == null || !ASTTest.class.isInstance(_parent)))
        {
            Class wrapper = OgnlRuntime.getPrimitiveWrapperClass(m.getReturnType());

            ExpressionCompiler.addCastString(context, "new " + wrapper.getName() + "(");
            post = ")";
            _getterClass = wrapper;
        }

        boolean varArgs = OgnlRuntime.isJdk15() && m.isVarArgs();

        if (varArgs)
        {
            throw new UnsupportedCompilationException("Javassist does not currently support varargs method calls");
        }

        try {
            /* if (lastChild(context) && m.getParameterTypes().length > 0 && _children.length <= 0)
                throw new UnsupportedCompilationException("Unable to determine setter method generation for " + m); */

            if ((_children != null) && (_children.length > 0))
            {
                Class[] parms = m.getParameterTypes();
                String prevCast = (String)context.remove(ExpressionCompiler.PRE_CAST);

                for(int i = 0; i < _children.length; i++)
                {
                    if (i > 0)
                    {
                        result += ", ";
                    }

                    Class prevType = context.getCurrentType();

                    context.setCurrentObject(context.getRoot());
                    context.setCurrentType(context.getRoot() != null ? context.getRoot().getClass() : null);
                    context.setCurrentAccessor(null);
                    context.setPreviousType(null);

                    Object value = _children[i].getValue(context, context.getRoot());
                    String parmString = _children[i].toSetSourceString(context, context.getRoot());

                    if (context.getCurrentType() == Void.TYPE || context.getCurrentType() == void.class)
                        throw new UnsupportedCompilationException("Method argument can't be a void type.");

                    if (parmString == null || parmString.trim().length() < 1)
                    {
                        if (ASTProperty.class.isInstance(_children[i]) || ASTMethod.class.isInstance(_children[i])
                            || ASTStaticMethod.class.isInstance(_children[i]) || ASTChain.class.isInstance(_children[i]))
                            throw new UnsupportedCompilationException("ASTMethod setter child returned null from a sub property expression.");

                        parmString = "null";
                    }

                    // to undo type setting of constants when used as method parameters
View Full Code Here

TOP

Related Classes of ognl.enhance.UnsupportedCompilationException

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.