Record Class PipedStatement

java.lang.Object
java.lang.Record
org.litebridgedb.orm.persistence.PipedStatement
Record Components:
statementBuilder - The statement builder to be used for building the dependency statement.
dto - The DTO associated with the statement.
valuePipe - The consumer for handling the UpdateResult generated by executing the statement.

public record PipedStatement(StatementBuilder<?> statementBuilder, Object dto, Consumer<UpdateResult> valuePipe) extends Record
A statement in the context of dependent database operations that is built using an AbstractStatementBuilder and optionally pipes result values using a Consumer.

This class is intended to encapsulate the process of preparing and managing a dependency of another database statement, associating an optional consumer for handling update results.

The class uses the following components: - AbstractStatementBuilder: Responsible for building the database statement. - Consumer: Handles the UpdateResult generated by executing the statement.

The primary constructor takes both a statement builder and a consumer for processing update results. An additional constructor allows for creating an instance with a default no-op consumer.

  • Constructor Details

    • PipedStatement

      public PipedStatement(StatementBuilder<?> statementBuilder, Object dto)
      Constructs a new PipedStatement using the given AbstractStatementBuilder.

      This constructor creates a piped statement with a default no-op consumer for handling update results.

      Parameters:
      statementBuilder - The statement builder to be used for building the dependency statement.
    • PipedStatement

      public PipedStatement(StatementBuilder<?> statementBuilder, Object dto, Consumer<UpdateResult> valuePipe)
      Creates an instance of a PipedStatement record class.
      Parameters:
      statementBuilder - the value for the statementBuilder record component
      dto - the value for the dto record component
      valuePipe - the value for the valuePipe record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • statementBuilder

      public StatementBuilder<?> statementBuilder()
      Returns the value of the statementBuilder record component.
      Returns:
      the value of the statementBuilder record component
    • dto

      public Object dto()
      Returns the value of the dto record component.
      Returns:
      the value of the dto record component
    • valuePipe

      public Consumer<UpdateResult> valuePipe()
      Returns the value of the valuePipe record component.
      Returns:
      the value of the valuePipe record component