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

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

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

import javax.annotation.processing.Generated;

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

  static Scalar primitive(Primitive primitive) {
    if (primitive == null) {
      throw new NullPointerException();
    }
    return new Impl_primitive(primitive);
  }

  static Scalar generic(Struct generic) {
    if (generic == null) {
      throw new NullPointerException();
    }
    return new Impl_generic(generic);
  }

  static Scalar blob(Blob blob) {
    if (blob == null) {
      throw new NullPointerException();
    }
    return new Impl_blob(blob);
  }

  // Parent class that each implementation will inherit from.
  private abstract static class Parent_ extends Scalar {
    @Override
    public Primitive primitive() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public Struct generic() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public Blob blob() {
      throw new UnsupportedOperationException(kind().toString());
    }
  }

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

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy