|
| 1 | +/** |
| 2 | + * This file was auto-generated by Fern from our API Definition. |
| 3 | + */ |
| 4 | +package com.assemblyai.api.types; |
| 5 | + |
| 6 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 7 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 8 | + |
| 9 | +public final class AudioEncoding { |
| 10 | + public static final AudioEncoding PCM_S_16_LE = new AudioEncoding(Value.PCM_S_16_LE, "pcm_s16le"); |
| 11 | + |
| 12 | + public static final AudioEncoding PCM_MULAW = new AudioEncoding(Value.PCM_MULAW, "pcm_mulaw"); |
| 13 | + |
| 14 | + private final Value value; |
| 15 | + |
| 16 | + private final String string; |
| 17 | + |
| 18 | + AudioEncoding(Value value, String string) { |
| 19 | + this.value = value; |
| 20 | + this.string = string; |
| 21 | + } |
| 22 | + |
| 23 | + public Value getEnumValue() { |
| 24 | + return value; |
| 25 | + } |
| 26 | + |
| 27 | + @Override |
| 28 | + @JsonValue |
| 29 | + public String toString() { |
| 30 | + return this.string; |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + public boolean equals(Object other) { |
| 35 | + return (this == other) |
| 36 | + || (other instanceof AudioEncoding && this.string.equals(((AudioEncoding) other).string)); |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public int hashCode() { |
| 41 | + return this.string.hashCode(); |
| 42 | + } |
| 43 | + |
| 44 | + public <T> T visit(Visitor<T> visitor) { |
| 45 | + switch (value) { |
| 46 | + case PCM_S_16_LE: |
| 47 | + return visitor.visitPcmS16Le(); |
| 48 | + case PCM_MULAW: |
| 49 | + return visitor.visitPcmMulaw(); |
| 50 | + case UNKNOWN: |
| 51 | + default: |
| 52 | + return visitor.visitUnknown(string); |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) |
| 57 | + public static AudioEncoding valueOf(String value) { |
| 58 | + switch (value) { |
| 59 | + case "pcm_s16le": |
| 60 | + return PCM_S_16_LE; |
| 61 | + case "pcm_mulaw": |
| 62 | + return PCM_MULAW; |
| 63 | + default: |
| 64 | + return new AudioEncoding(Value.UNKNOWN, value); |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + public enum Value { |
| 69 | + PCM_S_16_LE, |
| 70 | + |
| 71 | + PCM_MULAW, |
| 72 | + |
| 73 | + UNKNOWN |
| 74 | + } |
| 75 | + |
| 76 | + public interface Visitor<T> { |
| 77 | + T visitPcmS16Le(); |
| 78 | + |
| 79 | + T visitPcmMulaw(); |
| 80 | + |
| 81 | + T visitUnknown(String unknownType); |
| 82 | + } |
| 83 | +} |
0 commit comments