Package org.datanucleus.query.node

Examples of org.datanucleus.query.node.Node


                        "\" but this is not a standard JDOQL method name");
                }
            }

            // Found syntax for a method, so invoke the method
            Node expr = new Node(NodeType.INVOKE, method);
            if (!p.parseChar(')'))
            {
                int numArgs = 0;
                do
                {
                    // Argument for the method call, add as a node property
                    processExpression();
                    expr.addProperty(stack.pop());
                    numArgs++;
                }
                while (p.parseChar(','));

                if (!p.parseChar(')'))
View Full Code Here


            // Array
            List<Node> elements = new ArrayList();
            while (!p.parseChar('}'))
            {
                processPrimary();
                Node elementNode = stack.pop();
                elements.add(elementNode);

                if (p.parseChar('}'))
                {
                    break;
                }
                else if (!p.parseChar(','))
                {
                    throw new QueryCompilerSyntaxException("',' or '}' expected", p.getIndex(), p.getInput());
                }
            }

            Node arrayNode = new Node(NodeType.ARRAY, elements);
            stack.push(arrayNode);

            // Check for "length" since won't be picked up by processMethod
            if (p.parseString(".length"))
            {
                Node lengthMethod = new Node(NodeType.INVOKE, "length");
                arrayNode.appendChildNode(lengthMethod);
            }

            return true;
        }
View Full Code Here

        else
        {
            return false;
        }

        stack.push(new Node(NodeType.LITERAL, litValue));
        return true;
    }
View Full Code Here

            {
                throw new QueryCompilerSyntaxException("Explicit parameters defined for query, yet implicit parameter syntax (\"" + id + "\") found");
            }

            // Named parameter - stored as String
            Node expr = new ParameterNode(NodeType.PARAMETER, id.substring(1), parameterPosition);
            parameterPosition++;
            stack.push(expr);
            return true;
        }
        else
        {
            Node expr = new Node(NodeType.IDENTIFIER, id);
            stack.push(expr);
            return true;
        }
    }
View Full Code Here

        else
        {
            return false;
        }

        stack.push(new Node(Node.LITERAL, litValue));
        return true;
    }
View Full Code Here

                throw new QueryInvalidParametersException("Query is using named parameters yet also has \"" + id + "\"");
            }
            String paramName = id.substring(1);
            try
            {
                Node expr = new ParameterNode(Node.PARAMETER, new Integer(paramName), parameterPosition);
                parameterPosition++;
                stack.push(expr);
                return true;
            }
            catch (NumberFormatException nfe)
            {
                throw new NucleusUserException("Numbered parameter syntax starting ? but isnt followed by numeric!");
            }
        }
        else if (first == ':')
        {
            // Named parameter - stored as String
            if (paramType == null)
            {
                paramType = ParameterType.NAMED;
            }
            else if (paramType == ParameterType.NUMBERED)
            {
                throw new QueryInvalidParametersException("Query is using numbered parameters yet also has \"" + id + "\"");
            }
            Node expr = new ParameterNode(Node.PARAMETER, id.substring(1), parameterPosition);
            parameterPosition++;
            stack.push(expr);
            return true;
        }
        else
        {
            Node expr = new Node(Node.IDENTIFIER, id);
            stack.push(expr);
            return true;
        }
    }
View Full Code Here

     */
    public Node parse(String expression)
    {
        p = new Lexer(expression, paramPrefixes);
        stack = new Stack();
        Node result = processExpression();

        if (p.ci.getIndex() != p.ci.getEndIndex())
        {
            // Error occurred in the JDOQL processing due to syntax error(s)
            String unparsed = p.getInput().substring(p.ci.getIndex());
View Full Code Here

        }
        if (!processIdentifier())
        {
            throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
        }
        Node nodeVariable = stack.pop();
        Node nodeType = stack.pop();
        nodeType.appendChildNode(nodeVariable);
        return nodeType;
    }
View Full Code Here

        stack = new Stack();
        List nodes = new ArrayList();
        do
        {
            processExpression();
            Node expr = stack.pop();
            nodes.add(expr);
        }
        while (p.parseString(","));
        return (Node[])nodes.toArray(new Node[nodes.size()]);
    }
View Full Code Here

            }
            if (!processIdentifier())
            {
                throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
            }
            Node nodeVariable = stack.pop();
            Node nodeType = stack.pop();
            nodes.add(new Node[]{nodeType, nodeVariable});
        }
        while (p.parseString(";"));
        return (Node[][]) nodes.toArray(new Node[nodes.size()][2]);
    }
View Full Code Here

TOP

Related Classes of org.datanucleus.query.node.Node

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.