|
| 1 | +// -------------------------------------------------------------------------------------------------------------------- |
| 2 | +// <copyright company="Aspose" file="MaxiCodeMode.java"> |
| 3 | +// Copyright (c) 2022 Aspose.BarCode for Cloud |
| 4 | +// </copyright> |
| 5 | +// <summary> |
| 6 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +// of this software and associated documentation files (the "Software"), to deal |
| 8 | +// in the Software without restriction, including without limitation the rights |
| 9 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +// copies of the Software, and to permit persons to whom the Software is |
| 11 | +// furnished to do so, subject to the following conditions: |
| 12 | +// |
| 13 | +// The above copyright notice and this permission notice shall be included in all |
| 14 | +// copies or substantial portions of the Software. |
| 15 | +// |
| 16 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | +// SOFTWARE. |
| 23 | +// </summary> |
| 24 | +// -------------------------------------------------------------------------------------------------------------------- |
| 25 | + |
| 26 | +package com.aspose.barcode.cloud.model; |
| 27 | + |
| 28 | +import com.google.gson.TypeAdapter; |
| 29 | +import com.google.gson.annotations.JsonAdapter; |
| 30 | +import com.google.gson.stream.JsonReader; |
| 31 | +import com.google.gson.stream.JsonWriter; |
| 32 | +import java.io.IOException; |
| 33 | + |
| 34 | +/** */ |
| 35 | +@JsonAdapter(MaxiCodeMode.Adapter.class) |
| 36 | +public enum MaxiCodeMode { |
| 37 | + MODE2("Mode2"), |
| 38 | + |
| 39 | + MODE3("Mode3"), |
| 40 | + |
| 41 | + MODE4("Mode4"), |
| 42 | + |
| 43 | + MODE5("Mode5"), |
| 44 | + |
| 45 | + MODE6("Mode6"); |
| 46 | + |
| 47 | + private final String value; |
| 48 | + |
| 49 | + MaxiCodeMode(String value) { |
| 50 | + this.value = value; |
| 51 | + } |
| 52 | + |
| 53 | + public String getValue() { |
| 54 | + return value; |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public String toString() { |
| 59 | + return String.valueOf(value); |
| 60 | + } |
| 61 | + |
| 62 | + public static MaxiCodeMode fromValue(String text) { |
| 63 | + for (MaxiCodeMode b : MaxiCodeMode.values()) { |
| 64 | + if (String.valueOf(b.value).equals(text)) { |
| 65 | + return b; |
| 66 | + } |
| 67 | + } |
| 68 | + return null; |
| 69 | + } |
| 70 | + |
| 71 | + public static class Adapter extends TypeAdapter<MaxiCodeMode> { |
| 72 | + @Override |
| 73 | + public void write(final JsonWriter jsonWriter, final MaxiCodeMode enumeration) |
| 74 | + throws IOException { |
| 75 | + jsonWriter.value(enumeration.getValue()); |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public MaxiCodeMode read(final JsonReader jsonReader) throws IOException { |
| 80 | + String value = jsonReader.nextString(); |
| 81 | + return MaxiCodeMode.fromValue(String.valueOf(value)); |
| 82 | + } |
| 83 | + } |
| 84 | +} |
0 commit comments