Class DeleteStatement

  • All Implemented Interfaces:
    Expression

    public final class DeleteStatement
    extends AbstractExpression
    Bulk delete operation apply to entities of a single entity class (together with its subclasses, if any).
    BNF: delete_statement ::= delete_clause [where_clause]

    Version:
    2.5
    Author:
    Pascal Filion
    Since:
    2.3
    • Constructor Detail

      • DeleteStatement

        public DeleteStatement​(AbstractExpression parent)
        Creates a new DeleteStatement.
        Parameters:
        parent - The parent of this expression
    • Method Detail

      • addDeleteClause

        public DeleteClause addDeleteClause()
        Manually adds the delete clause to this delete statement.
      • getDeleteClause

        public DeleteClause getDeleteClause()
        Returns the Expression representing the DELETE clause.
        Returns:
        The expression that was parsed representing the DELETE expression
      • getWhereClause

        public Expression getWhereClause()
        Returns the Expression representing the WHERE clause.
        Returns:
        The expression representing the WHERE clause
      • hasSpaceAfterDeleteClause

        public boolean hasSpaceAfterDeleteClause()
        Determines whether a whitespace was found after the DELETE FROM clause. In some cases, the space is owned by a child of the DELETE FROM clause.
        Returns:
        true if there was a whitespace after the DELETE FROM clause and owned by this expression; false otherwise
      • hasWhereClause

        public boolean hasWhereClause()
        Determines whether the WHERE clause is defined.
        Returns:
        true if the query that got parsed had the WHERE clause
      • parse

        protected void parse​(WordParser wordParser,
                             boolean tolerant)
        Parses the query by starting at the current position, which is part of the given WordParser.
        Specified by:
        parse in class AbstractExpression
        Parameters:
        wordParser - The text to parse based on the current position of the cursor
        tolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
      • toParsedText

        protected void toParsedText​(java.lang.StringBuilder writer,
                                    boolean actual)
        Generates a string representation of this Expression, including its children, if it has any.
        Specified by:
        toParsedText in class AbstractExpression
        Parameters:
        writer - The buffer used to append this Expression's string representation
        actual - Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers