src/main/java/ognl/enhance/ExpressionCompiler.java
public static boolean shouldCast(Node expression)
    {
        if (ASTChain.class.isInstance(expression))
        {
            Node child = expression.jjtGetChild(0);
            if (ASTConst.class.isInstance(child)
                || ASTStaticMethod.class.isInstance(child)
                || ASTStaticField.class.isInstance(child)
                || (ASTVarRef.class.isInstance(child) && !ASTRootVarRef.class.isInstance(child)))
                return false;
        }

        return !ASTConst.class.isInstance(expression);
    }
public static boolean shouldCast(Node expression)
    {
        if (ASTChain.class.isInstance(expression))
        {
            Node child = expression.jjtGetChild(0);
            if (ASTConst.class.isInstance(child)
                || ASTStaticMethod.class.isInstance(child)
                || ASTStaticField.class.isInstance(child)
                || (ASTVarRef.class.isInstance(child) && !ASTRootVarRef.class.isInstance(child)))
                return false;
        }

        return !ASTConst.class.isInstance(expression);
    }
public static boolean shouldCast ( Node expression ) { if ( ASTChain . class . isInstance ( expression ) ) { Node child = expression . jjtGetChild ( 0 ) ; if ( ASTConst . class . isInstance ( child ) || ASTStaticMethod . class . isInstance ( child ) || ASTStaticField . class . isInstance ( child ) || ( ASTVarRef . class . isInstance ( child ) && ! ASTRootVarRef . class . isInstance ( child ) ) ) return false ; } return ! ASTConst . class . isInstance ( expression ) ; }
Used by {@link #getRootExpression(ognl.Node, Object, ognl.OgnlContext)} to determine if the expression
needs to be cast at all.

@param expression
The node to check against.
@return Yes if the node type should be cast - false otherwise.
Used by { @link #getRootExpression ( ognl . Node Object ognl . OgnlContext ) } to determine if the expression needs to be cast at all .