All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.flyte.api.v1.AutoOneOf_Struct_Value Maven / Gradle / Ivy

There is a newer version: 0.4.60
Show newest version
package org.flyte.api.v1;

import java.util.List;
import javax.annotation.processing.Generated;

@Generated("com.google.auto.value.processor.AutoOneOfProcessor")
final class AutoOneOf_Struct_Value {
  private AutoOneOf_Struct_Value() {} // There are no instances of this type.

  static Struct.Value stringValue(String stringValue) {
    if (stringValue == null) {
      throw new NullPointerException();
    }
    return new Impl_stringValue(stringValue);
  }

  static Struct.Value boolValue(boolean boolValue) {
    return new Impl_boolValue(boolValue);
  }

  static Struct.Value listValue(List listValue) {
    if (listValue == null) {
      throw new NullPointerException();
    }
    return new Impl_listValue(listValue);
  }

  static Struct.Value structValue(Struct structValue) {
    if (structValue == null) {
      throw new NullPointerException();
    }
    return new Impl_structValue(structValue);
  }

  static Struct.Value numberValue(double numberValue) {
    return new Impl_numberValue(numberValue);
  }

  static Struct.Value nullValue() {
    return Impl_nullValue.INSTANCE;
  }

  // Parent class that each implementation will inherit from.
  private abstract static class Parent_ extends Struct.Value {
    @Override
    public String stringValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public boolean boolValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public List listValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public Struct structValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public double numberValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public void nullValue() {
      throw new UnsupportedOperationException(kind().toString());
    }
  }

  // Implementation when the contained property is "stringValue".
  private static final class Impl_stringValue extends Parent_ {
    private final String stringValue;
    Impl_stringValue(String stringValue) {
      this.stringValue = stringValue;
    }
    @Override
    public String stringValue() {
      return stringValue;
    }
    @Override
    public String toString() {
      return "Value{stringValue=" + this.stringValue + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Struct.Value) {
        Struct.Value that = (Struct.Value) x;
        return this.kind() == that.kind()
            && this.stringValue.equals(that.stringValue());
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return stringValue.hashCode();
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.STRING_VALUE;
    }
  }

  // Implementation when the contained property is "boolValue".
  private static final class Impl_boolValue extends Parent_ {
    private final boolean boolValue;
    Impl_boolValue(boolean boolValue) {
      this.boolValue = boolValue;
    }
    @Override
    public boolean boolValue() {
      return boolValue;
    }
    @Override
    public String toString() {
      return "Value{boolValue=" + this.boolValue + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Struct.Value) {
        Struct.Value that = (Struct.Value) x;
        return this.kind() == that.kind()
            && this.boolValue == that.boolValue();
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return boolValue ? 1231 : 1237;
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.BOOL_VALUE;
    }
  }

  // Implementation when the contained property is "listValue".
  private static final class Impl_listValue extends Parent_ {
    private final List listValue;
    Impl_listValue(List listValue) {
      this.listValue = listValue;
    }
    @Override
    public List listValue() {
      return listValue;
    }
    @Override
    public String toString() {
      return "Value{listValue=" + this.listValue + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Struct.Value) {
        Struct.Value that = (Struct.Value) x;
        return this.kind() == that.kind()
            && this.listValue.equals(that.listValue());
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return listValue.hashCode();
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.LIST_VALUE;
    }
  }

  // Implementation when the contained property is "structValue".
  private static final class Impl_structValue extends Parent_ {
    private final Struct structValue;
    Impl_structValue(Struct structValue) {
      this.structValue = structValue;
    }
    @Override
    public Struct structValue() {
      return structValue;
    }
    @Override
    public String toString() {
      return "Value{structValue=" + this.structValue + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Struct.Value) {
        Struct.Value that = (Struct.Value) x;
        return this.kind() == that.kind()
            && this.structValue.equals(that.structValue());
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return structValue.hashCode();
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.STRUCT_VALUE;
    }
  }

  // Implementation when the contained property is "numberValue".
  private static final class Impl_numberValue extends Parent_ {
    private final double numberValue;
    Impl_numberValue(double numberValue) {
      this.numberValue = numberValue;
    }
    @Override
    public double numberValue() {
      return numberValue;
    }
    @Override
    public String toString() {
      return "Value{numberValue=" + this.numberValue + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Struct.Value) {
        Struct.Value that = (Struct.Value) x;
        return this.kind() == that.kind()
            && Double.doubleToLongBits(this.numberValue) == Double.doubleToLongBits(that.numberValue());
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return (int) ((Double.doubleToLongBits(numberValue) >>> 32) ^ Double.doubleToLongBits(numberValue));
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.NUMBER_VALUE;
    }
  }

  // Implementation when the contained property is "nullValue".
  private static final class Impl_nullValue extends Parent_ {
    // There is only one instance of this class.
    static final Impl_nullValue INSTANCE = new Impl_nullValue();
    private Impl_nullValue() {}
    @Override
    public void nullValue() {}
    @Override
    public String toString() {
      return "Value{nullValue}";
    }
    @Override
    public boolean equals(Object x) {
      return x == this;
    }
    @Override
    public int hashCode() {
      return System.identityHashCode(this);
    }
    @Override
    public Struct.Value.Kind kind() {
      return Struct.Value.Kind.NULL_VALUE;
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy