Record Class InsertNode

java.lang.Object
java.lang.Record
org.litebridge.orm.engine.ast.InsertNode
Record Components:
table - name of the table to insert into
dtoClass - class of the DTO to insert
contextDtoClass - The parent/context DTO class for determining the correct dtoClass table mapping (for shared DTOs mapped to multiple distinct tables)
columns - names of the columns to insert into
expressionSpecs - expressions to use instead of columns
All Implemented Interfaces:
QueryNode

public record InsertNode(@Nullable String table, @Nullable Class<?> dtoClass, @Nullable Class<?> contextDtoClass, String @Nullable [] columns, ExpressionSpec @Nullable [] expressionSpecs) extends Record implements QueryNode
Represents an INSERT statement in the query AST.

This is a root node.

  • Constructor Details

    • InsertNode

      public InsertNode(@Nullable String table, @Nullable Class<?> dtoClass, String[] columns)
      Creates a new InsertNode instance with column names.
      Parameters:
      table - the target table name, or null
      dtoClass - the target DTO class, or null
      columns - the column names to insert into
    • InsertNode

      public InsertNode(@Nullable String table, @Nullable Class<?> dtoClass, ExpressionSpec[] expressionSpecs)
      Creates a new InsertNode instance with expression specifications.
      Parameters:
      table - the target table name, or null
      dtoClass - the target DTO class, or null
      expressionSpecs - the expression specifications to insert
    • InsertNode

      public InsertNode(@Nullable String table, @Nullable Class<?> dtoClass, @Nullable Class<?> contextDtoClass, String @Nullable [] columns, ExpressionSpec @Nullable [] expressionSpecs)
      Creates an instance of a InsertNode record class.
      Parameters:
      table - the value for the table record component
      dtoClass - the value for the dtoClass record component
      contextDtoClass - the value for the contextDtoClass record component
      columns - the value for the columns record component
      expressionSpecs - the value for the expressionSpecs record component
  • Method Details

    • previous

      public @Nullable QueryNode previous()
      Description copied from interface: QueryNode
      Returns the previous node in the chain, or null if this is the root node.
      Specified by:
      previous in interface QueryNode
      Returns:
      the previous node
    • equals

      public 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.
    • hashCode

      public 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
    • 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
    • table

      public @Nullable String table()
      Returns the value of the table record component.
      Returns:
      the value of the table record component
    • dtoClass

      public @Nullable Class<?> dtoClass()
      Returns the value of the dtoClass record component.
      Returns:
      the value of the dtoClass record component
    • contextDtoClass

      public @Nullable Class<?> contextDtoClass()
      Returns the value of the contextDtoClass record component.
      Returns:
      the value of the contextDtoClass record component
    • columns

      public String @Nullable [] columns()
      Returns the value of the columns record component.
      Returns:
      the value of the columns record component
    • expressionSpecs

      public ExpressionSpec @Nullable [] expressionSpecs()
      Returns the value of the expressionSpecs record component.
      Returns:
      the value of the expressionSpecs record component