Class SqlTypeSetterVisitor

  • All Implemented Interfaces:
    Visitor<com.rabbitmq.jms.parse.sql.SqlTreeNode>

    public class SqlTypeSetterVisitor
    extends java.lang.Object
    implements Visitor<com.rabbitmq.jms.parse.sql.SqlTreeNode>
    This visitor sets the type of the expression at a node of a tree, using the type of node and the SqlExpressionType of the children nodes.

    To type a whole tree this can be applied to it by visiting the subtrees in ‘post-order’; each node visited then has its child nodes already visited and therefore typed. In consequence, this visitor does nothing in its Visitor.visitBefore(Object, Object[]) implementation.

    The visitor has a (final) map state which pre-specifies the SqlExpressionType of some identifiers, otherwise identifiers are of type SqlExpressionType.ANY.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean visitAfter​(com.rabbitmq.jms.parse.sql.SqlTreeNode parent, com.rabbitmq.jms.parse.sql.SqlTreeNode[] children)
      Visit a place in the tree: the Node for this place in the tree, and an array of Visitors of the immediate children, are passed as parameters.
      boolean visitBefore​(com.rabbitmq.jms.parse.sql.SqlTreeNode parent, com.rabbitmq.jms.parse.sql.SqlTreeNode[] children)
      Visit a place in the tree: the Node for this place in the tree, and an array of Visitors of the immediate children, are passed as parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SqlTypeSetterVisitor

        public SqlTypeSetterVisitor​(java.util.Map<java.lang.String,​SqlExpressionType> identifierType)
      • SqlTypeSetterVisitor

        public SqlTypeSetterVisitor()
    • Method Detail

      • visitBefore

        public boolean visitBefore​(com.rabbitmq.jms.parse.sql.SqlTreeNode parent,
                                   com.rabbitmq.jms.parse.sql.SqlTreeNode[] children)
        Description copied from interface: Visitor
        Visit a place in the tree: the Node for this place in the tree, and an array of Visitors of the immediate children, are passed as parameters.
        Specified by:
        visitBefore in interface Visitor<com.rabbitmq.jms.parse.sql.SqlTreeNode>
        Parameters:
        parent - - the node (value) of the parent at this point in the tree; can be updated.
        children - - array of the nodes of the children of this parent (can be zero-length array; must not be null).
        Returns:
        true or false - interpreted by the caller (typically a tree traversal algorithm).
      • visitAfter

        public boolean visitAfter​(com.rabbitmq.jms.parse.sql.SqlTreeNode parent,
                                  com.rabbitmq.jms.parse.sql.SqlTreeNode[] children)
        Description copied from interface: Visitor
        Visit a place in the tree: the Node for this place in the tree, and an array of Visitors of the immediate children, are passed as parameters.
        Specified by:
        visitAfter in interface Visitor<com.rabbitmq.jms.parse.sql.SqlTreeNode>
        Parameters:
        parent - - the node (value) of the parent at this point in the tree; can be updated.
        children - - array of the nodes of the children of this parent (can be zero-length array; must not be null).
        Returns:
        true or false - interpreted by the caller (typically a tree traversal algorithm).