Class ImmutableFieldReference

java.lang.Object
io.substrait.expression.FieldReference
io.substrait.expression.ImmutableFieldReference
All Implemented Interfaces:
Expression, FunctionArg

public final class ImmutableFieldReference extends FieldReference
Immutable implementation of FieldReference.

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

  • Method Details

    • segments

      Specified by:
      segments in class FieldReference
      Returns:
      The value of the segments attribute
    • type

      public Type type()
      Specified by:
      type in class FieldReference
      Returns:
      The value of the type attribute
    • inputExpression

      public Optional<Expression> inputExpression()
      Specified by:
      inputExpression in class FieldReference
      Returns:
      The value of the inputExpression attribute
    • outerReferenceStepsOut

      public Optional<Integer> outerReferenceStepsOut()
      Specified by:
      outerReferenceStepsOut in class FieldReference
      Returns:
      The value of the outerReferenceStepsOut attribute
    • lambdaParameterReferenceStepsOut

      public Optional<Integer> lambdaParameterReferenceStepsOut()
      Specified by:
      lambdaParameterReferenceStepsOut in class FieldReference
      Returns:
      The value of the lambdaParameterReferenceStepsOut attribute
    • withSegments

      public final ImmutableFieldReference withSegments(FieldReference.ReferenceSegment... elements)
      Copy the current immutable object with elements that replace the content of segments.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withSegments

      public final ImmutableFieldReference withSegments(Iterable<? extends FieldReference.ReferenceSegment> elements)
      Copy the current immutable object with elements that replace the content of segments. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of segments elements to set
      Returns:
      A modified copy or this if not changed
    • withType

      public final ImmutableFieldReference withType(Type value)
      Copy the current immutable object by setting a value for the type attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type
      Returns:
      A modified copy or the this object
    • withInputExpression

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

      public final ImmutableFieldReference withInputExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the inputExpression 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 inputExpression
      Returns:
      A modified copy or this if not changed
    • withOuterReferenceStepsOut

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

      public final ImmutableFieldReference withOuterReferenceStepsOut(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the outerReferenceStepsOut attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for outerReferenceStepsOut
      Returns:
      A modified copy or this if not changed
    • withLambdaParameterReferenceStepsOut

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

      public final ImmutableFieldReference withLambdaParameterReferenceStepsOut(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the lambdaParameterReferenceStepsOut attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for lambdaParameterReferenceStepsOut
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableFieldReference 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: segments, type, inputExpression, outerReferenceStepsOut, lambdaParameterReferenceStepsOut.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableFieldReference copyOf(FieldReference instance)
      Creates an immutable copy of a FieldReference 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 FieldReference instance
    • builder

      public static ImmutableFieldReference.Builder builder()
      Creates a builder for ImmutableFieldReference.
       ImmutableFieldReference.builder()
          .addSegments|addAllSegments(io.substrait.expression.FieldReference.ReferenceSegment) // segments elements
          .type(io.substrait.type.Type) // required type
          .inputExpression(Optional<io.substrait.expression.Expression>) // optional inputExpression
          .outerReferenceStepsOut(Optional<Integer>) // optional outerReferenceStepsOut
          .lambdaParameterReferenceStepsOut(Optional<Integer>) // optional lambdaParameterReferenceStepsOut
          .build();
       
      Returns:
      A new ImmutableFieldReference builder