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

com.adgear.anoa.test.nested.Enum Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */

package com.adgear.anoa.test.nested;

public interface Enum
  extends java.util.function.Supplier,
          java.io.Serializable {

  /** Returns underlying object. */
  T get();

  /** Returns enumeration ordinal. */
  default int getOrdinal() { return hashCode(); }

  default boolean isOff() { return 0 == getOrdinal(); }
  default boolean isOn() { return 1 == getOrdinal(); }


  enum NativeImpl implements com.adgear.anoa.test.nested.Enum {
    OFF,
    ON;

    @Override public NativeImpl get() { return this; }

    @Override public int getOrdinal() { return ordinal(); }

    static public final long serialVersionUID = 2;
  }

  /** Returns enum instance for the given Enum. */
  static NativeImpl nativeImpl(com.adgear.anoa.test.nested.Enum instance) {
    return nativeImpl(instance.getOrdinal());
  }

  /** Returns enum instance for the given ordinal, defaults to first enum value. */
  static NativeImpl nativeImpl(int ordinal) {
    switch (ordinal) {
      case 0: return NativeImpl.OFF;
      case 1: return NativeImpl.ON;
    }
    return NativeImpl.OFF;
  }

  /** Returns enum instance for the given label, defaults to first enum value. */
  static NativeImpl nativeImpl(java.lang.CharSequence str) {
    if (str != null) {
      switch (str.toString().toUpperCase()) {
        case "OFF": return NativeImpl.OFF;
        case "ON": return NativeImpl.ON;
      }
    }
    return NativeImpl.OFF;
  }

  static class Avro implements com.adgear.anoa.test.nested.Enum {

    static public Avro OFF = new Avro(com.adgear.anoa.test.nested.EnumAvro.OFF);
    static public Avro ON = new Avro(com.adgear.anoa.test.nested.EnumAvro.ON);

    final private com.adgear.anoa.test.nested.EnumAvro wrapped;

    private Avro(com.adgear.anoa.test.nested.EnumAvro wrapped) {
      this.wrapped = wrapped;
    }

    @Override public com.adgear.anoa.test.nested.EnumAvro get() { return wrapped; }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null || !(other instanceof com.adgear.anoa.test.nested.Enum)) return false;
      return wrapped.ordinal() == ((com.adgear.anoa.test.nested.Enum) other).getOrdinal();
    }

    @Override public int hashCode() { return wrapped.ordinal(); }

    @Override public String toString() { return wrapped.toString(); }

    static public final long serialVersionUID = 2;
  }

  /** Returns enum instance for the given Enum. */
  static Avro avro(com.adgear.anoa.test.nested.Enum instance) {
    return avro(instance.getOrdinal());
  }

  /** Returns enum instance for the given Avro enum. */
  static Avro avro(com.adgear.anoa.test.nested.EnumAvro instance) {
    return avro(instance.ordinal());
  }

  /** Returns enum instance for the given ordinal, defaults to first enum value. */
  static Avro avro(int ordinal) {
    switch (ordinal) {
      case 0: return Avro.OFF;
      case 1: return Avro.ON;
    }
    return Avro.OFF;
  }

  /** Returns enum instance for the given label, defaults to first enum value. */
  static Avro avro(java.lang.CharSequence str) {
    if (str != null) {
      switch (str.toString().toUpperCase()) {
        case "OFF": return Avro.OFF;
        case "ON": return Avro.ON;
      }
    }
    return Avro.OFF;
  }

  /** Returns Avro enum class. */
  static java.lang.Class getAvroClass() {
    return com.adgear.anoa.test.nested.EnumAvro.class;
  }

  /** Returns Avro enum schema. */
  static org.apache.avro.Schema getAvroSchema() {
    return com.adgear.anoa.test.nested.EnumAvro.SCHEMA$;
  }

  static class Protobuf implements com.adgear.anoa.test.nested.Enum {

    static public Protobuf OFF = new Protobuf(com.adgear.anoa.test.nested.NestedProtobuf.Enum.OFF);
    static public Protobuf ON = new Protobuf(com.adgear.anoa.test.nested.NestedProtobuf.Enum.ON);

    final private com.adgear.anoa.test.nested.NestedProtobuf.Enum wrapped;

    private Protobuf(com.adgear.anoa.test.nested.NestedProtobuf.Enum wrapped) {
      this.wrapped = wrapped;
    }

    @Override public com.adgear.anoa.test.nested.NestedProtobuf.Enum get() { return wrapped; }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null || !(other instanceof com.adgear.anoa.test.nested.Enum)) return false;
      return wrapped.getNumber() == ((com.adgear.anoa.test.nested.Enum) other).getOrdinal();
    }

    @Override public int hashCode() { return wrapped.getNumber(); }

    @Override public String toString() { return wrapped.toString(); }

    static public final long serialVersionUID = 2;
  }

  /** Returns enum instance for the given Enum. */
  static Protobuf protobuf(com.adgear.anoa.test.nested.Enum instance) {
    return protobuf(instance.getOrdinal());
  }

  /** Returns enum instance for the given Protobuf enum. */
  static Protobuf protobuf(com.adgear.anoa.test.nested.NestedProtobuf.Enum instance) {
    return protobuf(instance.getNumber());
  }

  /** Returns enum instance for the given ordinal, defaults to first enum value. */
  static Protobuf protobuf(int ordinal) {
    switch (ordinal) {
      case 0: return Protobuf.OFF;
      case 1: return Protobuf.ON;
    }
    return Protobuf.OFF;
  }

  /** Returns enum instance for the given label, defaults to first enum value. */
  static Protobuf protobuf(java.lang.CharSequence str) {
    if (str != null) {
      switch (str.toString().toUpperCase()) {
        case "OFF": return Protobuf.OFF;
        case "ON": return Protobuf.ON;
      }
    }
    return Protobuf.OFF;
  }

  /** Returns Protobuf class for this enum. */
  static java.lang.Class getProtobufClass() {
    return com.adgear.anoa.test.nested.NestedProtobuf.Enum.class;
  }

  /** Returns Protobuf protocol class for this enum. */
  static java.lang.Class getProtobufProtocolClass() {
    return com.adgear.anoa.test.nested.NestedProtobuf.class;
  }

  /** Returns Protobuf descriptor for this enum. */
  static com.google.protobuf.Descriptors.EnumDescriptor getProtobufDescriptor() {
    return com.adgear.anoa.test.nested.NestedProtobuf.Enum.getDescriptor();
  }

  /** Returns Protobuf protocol descriptor for this enum. */
  static com.google.protobuf.Descriptors.FileDescriptor getProtobufProtocolDescriptor() {
    return com.adgear.anoa.test.nested.NestedProtobuf.getDescriptor();
  }

  static class Thrift implements com.adgear.anoa.test.nested.Enum {

    static public Thrift OFF = new Thrift(com.adgear.anoa.test.nested.EnumThrift.OFF);
    static public Thrift ON = new Thrift(com.adgear.anoa.test.nested.EnumThrift.ON);

    private Thrift(com.adgear.anoa.test.nested.EnumThrift wrapped) {
      this.wrapped = wrapped;
    }

    final private com.adgear.anoa.test.nested.EnumThrift wrapped;

    @Override public com.adgear.anoa.test.nested.EnumThrift get() { return wrapped; }

    @Override public boolean equals(Object other) {
      if (other == this) return true;
      if (other == null || !(other instanceof com.adgear.anoa.test.nested.Enum)) return false;
      return wrapped.getValue() == ((com.adgear.anoa.test.nested.Enum) other).getOrdinal();
    }

    @Override public int hashCode() { return wrapped.getValue(); }

    @Override public String toString() { return wrapped.toString(); }

    static public final long serialVersionUID = 2;
  }

  /** Returns enum instance for the given Enum. */
  static Thrift thrift(com.adgear.anoa.test.nested.Enum instance) {
    return thrift(instance.getOrdinal());
  }

  /** Returns enum instance for the given Thrift enum. */
  static Thrift thrift(com.adgear.anoa.test.nested.EnumThrift instance) {
    return thrift(instance.ordinal());
  }

  /** Returns enum instance for the given ordinal, defaults to first enum value. */
  static Thrift thrift(int ordinal) {
    switch (ordinal) {
      case 0: return Thrift.OFF;
      case 1: return Thrift.ON;
    }
    return Thrift.OFF;
  }

  /** Returns enum instance for the given label, defaults to first enum value. */
  static Thrift thrift(java.lang.CharSequence str) {
    if (str != null) {
      switch (str.toString().toUpperCase()) {
        case "OFF": return Thrift.OFF;
        case "ON": return Thrift.ON;
      }
    }
    return Thrift.OFF;
  }

  /** Returns Thrift class for this enum. */
  static java.lang.Class getThriftClass() {
    return com.adgear.anoa.test.nested.EnumThrift.class;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy