Class ImmutableExtensionDdl

All Implemented Interfaces:
HasExtension, Rel

public final class ImmutableExtensionDdl extends ExtensionDdl
Immutable implementation of ExtensionDdl.

Use the builder to create immutable instances: ImmutableExtensionDdl.builder().

  • Method Details

    • getExtension

      public Optional<AdvancedExtension> getExtension()
      Returns:
      the AdvancedExtension associated directly with the class
    • getRemap

      public Optional<Rel.Remap> getRemap()
      Returns:
      The value of the remap attribute
    • getCommonExtension

      public Optional<AdvancedExtension> getCommonExtension()
      Returns:
      the AdvancedExtension associated with a RelCommon message, if present
    • getHint

      public Optional<Hint> getHint()
      Returns:
      The value of the hint attribute
    • getTableSchema

      public NamedStruct getTableSchema()
      Returns the target table/view schema (names + types).
      Specified by:
      getTableSchema in class AbstractDdlRel
      Returns:
      target NamedStruct
    • getTableDefaults

      public Expression.StructLiteral getTableDefaults()
      Returns default values for the table columns.
      Specified by:
      getTableDefaults in class AbstractDdlRel
      Returns:
      defaults as Expression.StructLiteral
    • getObject

      public AbstractDdlRel.DdlObject getObject()
      Returns the DDL object kind (table or view).
      Specified by:
      getObject in class AbstractDdlRel
      Returns:
      DDL object
    • getOperation

      public AbstractDdlRel.DdlOp getOperation()
      Returns the DDL operation (create/alter/drop, etc.).
      Specified by:
      getOperation in class AbstractDdlRel
      Returns:
      DDL operation
    • getViewDefinition

      public Optional<Rel> getViewDefinition()
      Returns the view definition when the object is a view.
      Specified by:
      getViewDefinition in class AbstractDdlRel
      Returns:
      optional view definition relation
    • getDetail

      public Extension.DdlExtensionObject getDetail()
      Specified by:
      getDetail in class ExtensionDdl
      Returns:
      The value of the detail attribute
    • withExtension

      public final ImmutableExtensionDdl withExtension(AdvancedExtension value)
      Copy the current immutable object by setting a present value for the optional extension attribute.
      Parameters:
      value - The value for extension
      Returns:
      A modified copy or this if not changed
    • withExtension

      public final ImmutableExtensionDdl withExtension(Optional<? extends AdvancedExtension> optional)
      Copy the current immutable object by setting an optional value for the extension attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for extension
      Returns:
      A modified copy or this if not changed
    • withRemap

      public final ImmutableExtensionDdl withRemap(Rel.Remap value)
      Copy the current immutable object by setting a present value for the optional remap attribute.
      Parameters:
      value - The value for remap
      Returns:
      A modified copy or this if not changed
    • withRemap

      public final ImmutableExtensionDdl withRemap(Optional<? extends Rel.Remap> optional)
      Copy the current immutable object by setting an optional value for the remap attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for remap
      Returns:
      A modified copy or this if not changed
    • withCommonExtension

      public final ImmutableExtensionDdl withCommonExtension(AdvancedExtension value)
      Copy the current immutable object by setting a present value for the optional commonExtension attribute.
      Parameters:
      value - The value for commonExtension
      Returns:
      A modified copy or this if not changed
    • withCommonExtension

      public final ImmutableExtensionDdl withCommonExtension(Optional<? extends AdvancedExtension> optional)
      Copy the current immutable object by setting an optional value for the commonExtension attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for commonExtension
      Returns:
      A modified copy or this if not changed
    • withHint

      public final ImmutableExtensionDdl withHint(Hint value)
      Copy the current immutable object by setting a present value for the optional hint attribute.
      Parameters:
      value - The value for hint
      Returns:
      A modified copy or this if not changed
    • withHint

      public final ImmutableExtensionDdl withHint(Optional<? extends Hint> optional)
      Copy the current immutable object by setting an optional value for the hint attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for hint
      Returns:
      A modified copy or this if not changed
    • withTableSchema

      public final ImmutableExtensionDdl withTableSchema(NamedStruct value)
      Copy the current immutable object by setting a value for the tableSchema attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for tableSchema
      Returns:
      A modified copy or the this object
    • withTableDefaults

      public final ImmutableExtensionDdl withTableDefaults(Expression.StructLiteral value)
      Copy the current immutable object by setting a value for the tableDefaults attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for tableDefaults
      Returns:
      A modified copy or the this object
    • withObject

      public final ImmutableExtensionDdl withObject(AbstractDdlRel.DdlObject value)
      Copy the current immutable object by setting a value for the object attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for object
      Returns:
      A modified copy or the this object
    • withOperation

      public final ImmutableExtensionDdl withOperation(AbstractDdlRel.DdlOp value)
      Copy the current immutable object by setting a value for the operation attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for operation
      Returns:
      A modified copy or the this object
    • withViewDefinition

      public final ImmutableExtensionDdl withViewDefinition(Rel value)
      Copy the current immutable object by setting a present value for the optional viewDefinition attribute.
      Parameters:
      value - The value for viewDefinition
      Returns:
      A modified copy or this if not changed
    • withViewDefinition

      public final ImmutableExtensionDdl withViewDefinition(Optional<? extends Rel> optional)
      Copy the current immutable object by setting an optional value for the viewDefinition attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for viewDefinition
      Returns:
      A modified copy or this if not changed
    • withDetail

      public final ImmutableExtensionDdl withDetail(Extension.DdlExtensionObject value)
      Copy the current immutable object by setting a value for the detail attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for detail
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableExtensionDdl that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: extension, remap, commonExtension, hint, tableSchema, tableDefaults, object, operation, viewDefinition, detail.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ExtensionDdl with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableExtensionDdl copyOf(ExtensionDdl instance)
      Creates an immutable copy of a ExtensionDdl value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ExtensionDdl instance
    • builder

      public static ImmutableExtensionDdl.Builder builder()
      Creates a builder for ImmutableExtensionDdl.
       ImmutableExtensionDdl.builder()
          .extension(Optional<io.substrait.extension.AdvancedExtension>) // optional extension
          .remap(Optional<io.substrait.relation.Rel.Remap>) // optional remap
          .commonExtension(Optional<io.substrait.extension.AdvancedExtension>) // optional commonExtension
          .hint(Optional<io.substrait.hint.Hint>) // optional hint
          .tableSchema(io.substrait.type.NamedStruct) // required tableSchema
          .tableDefaults(io.substrait.expression.Expression.StructLiteral) // required tableDefaults
          .object(io.substrait.relation.AbstractDdlRel.DdlObject) // required object
          .operation(io.substrait.relation.AbstractDdlRel.DdlOp) // required operation
          .viewDefinition(Optional<io.substrait.relation.Rel>) // optional viewDefinition
          .detail(io.substrait.relation.Extension.DdlExtensionObject) // required detail
          .build();
       
      Returns:
      A new ImmutableExtensionDdl builder