1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/language/v1/language_service.proto 18 19 package com.google.cloud.language.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * Represents the text encoding that the caller uses to process the output. 26 * Providing an `EncodingType` is recommended because the API provides the 27 * beginning offsets for various outputs, such as tokens and mentions, and 28 * languages that natively use different text encodings may access offsets 29 * differently. 30 * </pre> 31 * 32 * Protobuf enum {@code google.cloud.language.v1.EncodingType} 33 */ 34 public enum EncodingType implements com.google.protobuf.ProtocolMessageEnum { 35 /** 36 * 37 * 38 * <pre> 39 * If `EncodingType` is not specified, encoding-dependent information (such as 40 * `begin_offset`) will be set at `-1`. 41 * </pre> 42 * 43 * <code>NONE = 0;</code> 44 */ 45 NONE(0), 46 /** 47 * 48 * 49 * <pre> 50 * Encoding-dependent information (such as `begin_offset`) is calculated based 51 * on the UTF-8 encoding of the input. C++ and Go are examples of languages 52 * that use this encoding natively. 53 * </pre> 54 * 55 * <code>UTF8 = 1;</code> 56 */ 57 UTF8(1), 58 /** 59 * 60 * 61 * <pre> 62 * Encoding-dependent information (such as `begin_offset`) is calculated based 63 * on the UTF-16 encoding of the input. Java and JavaScript are examples of 64 * languages that use this encoding natively. 65 * </pre> 66 * 67 * <code>UTF16 = 2;</code> 68 */ 69 UTF16(2), 70 /** 71 * 72 * 73 * <pre> 74 * Encoding-dependent information (such as `begin_offset`) is calculated based 75 * on the UTF-32 encoding of the input. Python is an example of a language 76 * that uses this encoding natively. 77 * </pre> 78 * 79 * <code>UTF32 = 3;</code> 80 */ 81 UTF32(3), 82 UNRECOGNIZED(-1), 83 ; 84 85 /** 86 * 87 * 88 * <pre> 89 * If `EncodingType` is not specified, encoding-dependent information (such as 90 * `begin_offset`) will be set at `-1`. 91 * </pre> 92 * 93 * <code>NONE = 0;</code> 94 */ 95 public static final int NONE_VALUE = 0; 96 /** 97 * 98 * 99 * <pre> 100 * Encoding-dependent information (such as `begin_offset`) is calculated based 101 * on the UTF-8 encoding of the input. C++ and Go are examples of languages 102 * that use this encoding natively. 103 * </pre> 104 * 105 * <code>UTF8 = 1;</code> 106 */ 107 public static final int UTF8_VALUE = 1; 108 /** 109 * 110 * 111 * <pre> 112 * Encoding-dependent information (such as `begin_offset`) is calculated based 113 * on the UTF-16 encoding of the input. Java and JavaScript are examples of 114 * languages that use this encoding natively. 115 * </pre> 116 * 117 * <code>UTF16 = 2;</code> 118 */ 119 public static final int UTF16_VALUE = 2; 120 /** 121 * 122 * 123 * <pre> 124 * Encoding-dependent information (such as `begin_offset`) is calculated based 125 * on the UTF-32 encoding of the input. Python is an example of a language 126 * that uses this encoding natively. 127 * </pre> 128 * 129 * <code>UTF32 = 3;</code> 130 */ 131 public static final int UTF32_VALUE = 3; 132 getNumber()133 public final int getNumber() { 134 if (this == UNRECOGNIZED) { 135 throw new java.lang.IllegalArgumentException( 136 "Can't get the number of an unknown enum value."); 137 } 138 return value; 139 } 140 141 /** 142 * @param value The numeric wire value of the corresponding enum entry. 143 * @return The enum associated with the given numeric wire value. 144 * @deprecated Use {@link #forNumber(int)} instead. 145 */ 146 @java.lang.Deprecated valueOf(int value)147 public static EncodingType valueOf(int value) { 148 return forNumber(value); 149 } 150 151 /** 152 * @param value The numeric wire value of the corresponding enum entry. 153 * @return The enum associated with the given numeric wire value. 154 */ forNumber(int value)155 public static EncodingType forNumber(int value) { 156 switch (value) { 157 case 0: 158 return NONE; 159 case 1: 160 return UTF8; 161 case 2: 162 return UTF16; 163 case 3: 164 return UTF32; 165 default: 166 return null; 167 } 168 } 169 internalGetValueMap()170 public static com.google.protobuf.Internal.EnumLiteMap<EncodingType> internalGetValueMap() { 171 return internalValueMap; 172 } 173 174 private static final com.google.protobuf.Internal.EnumLiteMap<EncodingType> internalValueMap = 175 new com.google.protobuf.Internal.EnumLiteMap<EncodingType>() { 176 public EncodingType findValueByNumber(int number) { 177 return EncodingType.forNumber(number); 178 } 179 }; 180 getValueDescriptor()181 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 182 if (this == UNRECOGNIZED) { 183 throw new java.lang.IllegalStateException( 184 "Can't get the descriptor of an unrecognized enum value."); 185 } 186 return getDescriptor().getValues().get(ordinal()); 187 } 188 getDescriptorForType()189 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 190 return getDescriptor(); 191 } 192 getDescriptor()193 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 194 return com.google.cloud.language.v1.LanguageServiceProto.getDescriptor().getEnumTypes().get(0); 195 } 196 197 private static final EncodingType[] VALUES = values(); 198 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)199 public static EncodingType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 200 if (desc.getType() != getDescriptor()) { 201 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 202 } 203 if (desc.getIndex() == -1) { 204 return UNRECOGNIZED; 205 } 206 return VALUES[desc.getIndex()]; 207 } 208 209 private final int value; 210 EncodingType(int value)211 private EncodingType(int value) { 212 this.value = value; 213 } 214 215 // @@protoc_insertion_point(enum_scope:google.cloud.language.v1.EncodingType) 216 } 217