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

org.flyte.api.v1.AutoOneOf_Operand 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_Operand {
  private AutoOneOf_Operand() {} // There are no instances of this type.

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

  static Operand var(String var) {
    if (var == null) {
      throw new NullPointerException();
    }
    return new Impl_var(var);
  }

  // Parent class that each implementation will inherit from.
  private abstract static class Parent_ extends Operand {
    @Override
    public Primitive primitive() {
      throw new UnsupportedOperationException(kind().toString());
    }
    @Override
    public String var() {
      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 "Operand{primitive=" + this.primitive + "}";
    }
    @Override
    public boolean equals(Object x) {
      if (x instanceof Operand) {
        Operand that = (Operand) x;
        return this.kind() == that.kind()
            && this.primitive.equals(that.primitive());
      } else {
        return false;
      }
    }
    @Override
    public int hashCode() {
      return primitive.hashCode();
    }
    @Override
    public Operand.Kind kind() {
      return Operand.Kind.PRIMITIVE;
    }
  }

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy