|
| 1 | +/** |
| 2 | + * Autogenerated by Thrift |
| 3 | + * |
| 4 | + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| 5 | + */ |
| 6 | +package org.apache.cassandra.thrift; |
| 7 | + |
| 8 | +import java.util.List; |
| 9 | +import java.util.ArrayList; |
| 10 | +import java.util.Map; |
| 11 | +import java.util.HashMap; |
| 12 | +import java.util.EnumMap; |
| 13 | +import java.util.Set; |
| 14 | +import java.util.HashSet; |
| 15 | +import java.util.EnumSet; |
| 16 | +import java.util.Collections; |
| 17 | +import java.util.BitSet; |
| 18 | +import java.nio.ByteBuffer; |
| 19 | +import java.util.Arrays; |
| 20 | +import org.slf4j.Logger; |
| 21 | +import org.slf4j.LoggerFactory; |
| 22 | + |
| 23 | +import org.apache.thrift.*; |
| 24 | +import org.apache.thrift.async.*; |
| 25 | +import org.apache.thrift.meta_data.*; |
| 26 | +import org.apache.thrift.transport.*; |
| 27 | +import org.apache.thrift.protocol.*; |
| 28 | + |
| 29 | +/** |
| 30 | + * invalid authentication request (user does not exist or credentials invalid) |
| 31 | + */ |
| 32 | +public class AuthenticationException extends Exception implements TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable { |
| 33 | + private static final TStruct STRUCT_DESC = new TStruct("AuthenticationException"); |
| 34 | + |
| 35 | + private static final TField WHY_FIELD_DESC = new TField("why", TType.STRING, (short)1); |
| 36 | + |
| 37 | + public String why; |
| 38 | + |
| 39 | + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ |
| 40 | + public enum _Fields implements TFieldIdEnum { |
| 41 | + WHY((short)1, "why"); |
| 42 | + |
| 43 | + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); |
| 44 | + |
| 45 | + static { |
| 46 | + for (_Fields field : EnumSet.allOf(_Fields.class)) { |
| 47 | + byName.put(field.getFieldName(), field); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Find the _Fields constant that matches fieldId, or null if its not found. |
| 53 | + */ |
| 54 | + public static _Fields findByThriftId(int fieldId) { |
| 55 | + switch(fieldId) { |
| 56 | + case 1: // WHY |
| 57 | + return WHY; |
| 58 | + default: |
| 59 | + return null; |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Find the _Fields constant that matches fieldId, throwing an exception |
| 65 | + * if it is not found. |
| 66 | + */ |
| 67 | + public static _Fields findByThriftIdOrThrow(int fieldId) { |
| 68 | + _Fields fields = findByThriftId(fieldId); |
| 69 | + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); |
| 70 | + return fields; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Find the _Fields constant that matches name, or null if its not found. |
| 75 | + */ |
| 76 | + public static _Fields findByName(String name) { |
| 77 | + return byName.get(name); |
| 78 | + } |
| 79 | + |
| 80 | + private final short _thriftId; |
| 81 | + private final String _fieldName; |
| 82 | + |
| 83 | + _Fields(short thriftId, String fieldName) { |
| 84 | + _thriftId = thriftId; |
| 85 | + _fieldName = fieldName; |
| 86 | + } |
| 87 | + |
| 88 | + public short getThriftFieldId() { |
| 89 | + return _thriftId; |
| 90 | + } |
| 91 | + |
| 92 | + public String getFieldName() { |
| 93 | + return _fieldName; |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + // isset id assignments |
| 98 | + |
| 99 | + public static final Map<_Fields, FieldMetaData> metaDataMap; |
| 100 | + static { |
| 101 | + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); |
| 102 | + tmpMap.put(_Fields.WHY, new FieldMetaData("why", TFieldRequirementType.REQUIRED, |
| 103 | + new FieldValueMetaData(TType.STRING))); |
| 104 | + metaDataMap = Collections.unmodifiableMap(tmpMap); |
| 105 | + FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap); |
| 106 | + } |
| 107 | + |
| 108 | + public AuthenticationException() { |
| 109 | + } |
| 110 | + |
| 111 | + public AuthenticationException( |
| 112 | + String why) |
| 113 | + { |
| 114 | + this(); |
| 115 | + this.why = why; |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * Performs a deep copy on <i>other</i>. |
| 120 | + */ |
| 121 | + public AuthenticationException(AuthenticationException other) { |
| 122 | + if (other.isSetWhy()) { |
| 123 | + this.why = other.why; |
| 124 | + } |
| 125 | + } |
| 126 | + |
| 127 | + public AuthenticationException deepCopy() { |
| 128 | + return new AuthenticationException(this); |
| 129 | + } |
| 130 | + |
| 131 | + @Override |
| 132 | + public void clear() { |
| 133 | + this.why = null; |
| 134 | + } |
| 135 | + |
| 136 | + public String getWhy() { |
| 137 | + return this.why; |
| 138 | + } |
| 139 | + |
| 140 | + public AuthenticationException setWhy(String why) { |
| 141 | + this.why = why; |
| 142 | + return this; |
| 143 | + } |
| 144 | + |
| 145 | + public void unsetWhy() { |
| 146 | + this.why = null; |
| 147 | + } |
| 148 | + |
| 149 | + /** Returns true if field why is set (has been asigned a value) and false otherwise */ |
| 150 | + public boolean isSetWhy() { |
| 151 | + return this.why != null; |
| 152 | + } |
| 153 | + |
| 154 | + public void setWhyIsSet(boolean value) { |
| 155 | + if (!value) { |
| 156 | + this.why = null; |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + public void setFieldValue(_Fields field, Object value) { |
| 161 | + switch (field) { |
| 162 | + case WHY: |
| 163 | + if (value == null) { |
| 164 | + unsetWhy(); |
| 165 | + } else { |
| 166 | + setWhy((String)value); |
| 167 | + } |
| 168 | + break; |
| 169 | + |
| 170 | + } |
| 171 | + } |
| 172 | + |
| 173 | + public Object getFieldValue(_Fields field) { |
| 174 | + switch (field) { |
| 175 | + case WHY: |
| 176 | + return getWhy(); |
| 177 | + |
| 178 | + } |
| 179 | + throw new IllegalStateException(); |
| 180 | + } |
| 181 | + |
| 182 | + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ |
| 183 | + public boolean isSet(_Fields field) { |
| 184 | + if (field == null) { |
| 185 | + throw new IllegalArgumentException(); |
| 186 | + } |
| 187 | + |
| 188 | + switch (field) { |
| 189 | + case WHY: |
| 190 | + return isSetWhy(); |
| 191 | + } |
| 192 | + throw new IllegalStateException(); |
| 193 | + } |
| 194 | + |
| 195 | + @Override |
| 196 | + public boolean equals(Object that) { |
| 197 | + if (that == null) |
| 198 | + return false; |
| 199 | + if (that instanceof AuthenticationException) |
| 200 | + return this.equals((AuthenticationException)that); |
| 201 | + return false; |
| 202 | + } |
| 203 | + |
| 204 | + public boolean equals(AuthenticationException that) { |
| 205 | + if (that == null) |
| 206 | + return false; |
| 207 | + |
| 208 | + boolean this_present_why = true && this.isSetWhy(); |
| 209 | + boolean that_present_why = true && that.isSetWhy(); |
| 210 | + if (this_present_why || that_present_why) { |
| 211 | + if (!(this_present_why && that_present_why)) |
| 212 | + return false; |
| 213 | + if (!this.why.equals(that.why)) |
| 214 | + return false; |
| 215 | + } |
| 216 | + |
| 217 | + return true; |
| 218 | + } |
| 219 | + |
| 220 | + @Override |
| 221 | + public int hashCode() { |
| 222 | + return 0; |
| 223 | + } |
| 224 | + |
| 225 | + public int compareTo(AuthenticationException other) { |
| 226 | + if (!getClass().equals(other.getClass())) { |
| 227 | + return getClass().getName().compareTo(other.getClass().getName()); |
| 228 | + } |
| 229 | + |
| 230 | + int lastComparison = 0; |
| 231 | + AuthenticationException typedOther = (AuthenticationException)other; |
| 232 | + |
| 233 | + lastComparison = Boolean.valueOf(isSetWhy()).compareTo(typedOther.isSetWhy()); |
| 234 | + if (lastComparison != 0) { |
| 235 | + return lastComparison; |
| 236 | + } |
| 237 | + if (isSetWhy()) { |
| 238 | + lastComparison = TBaseHelper.compareTo(this.why, typedOther.why); |
| 239 | + if (lastComparison != 0) { |
| 240 | + return lastComparison; |
| 241 | + } |
| 242 | + } |
| 243 | + return 0; |
| 244 | + } |
| 245 | + |
| 246 | + public _Fields fieldForId(int fieldId) { |
| 247 | + return _Fields.findByThriftId(fieldId); |
| 248 | + } |
| 249 | + |
| 250 | + public void read(TProtocol iprot) throws TException { |
| 251 | + TField field; |
| 252 | + iprot.readStructBegin(); |
| 253 | + while (true) |
| 254 | + { |
| 255 | + field = iprot.readFieldBegin(); |
| 256 | + if (field.type == TType.STOP) { |
| 257 | + break; |
| 258 | + } |
| 259 | + switch (field.id) { |
| 260 | + case 1: // WHY |
| 261 | + if (field.type == TType.STRING) { |
| 262 | + this.why = iprot.readString(); |
| 263 | + } else { |
| 264 | + TProtocolUtil.skip(iprot, field.type); |
| 265 | + } |
| 266 | + break; |
| 267 | + default: |
| 268 | + TProtocolUtil.skip(iprot, field.type); |
| 269 | + } |
| 270 | + iprot.readFieldEnd(); |
| 271 | + } |
| 272 | + iprot.readStructEnd(); |
| 273 | + |
| 274 | + // check for required fields of primitive type, which can't be checked in the validate method |
| 275 | + validate(); |
| 276 | + } |
| 277 | + |
| 278 | + public void write(TProtocol oprot) throws TException { |
| 279 | + validate(); |
| 280 | + |
| 281 | + oprot.writeStructBegin(STRUCT_DESC); |
| 282 | + if (this.why != null) { |
| 283 | + oprot.writeFieldBegin(WHY_FIELD_DESC); |
| 284 | + oprot.writeString(this.why); |
| 285 | + oprot.writeFieldEnd(); |
| 286 | + } |
| 287 | + oprot.writeFieldStop(); |
| 288 | + oprot.writeStructEnd(); |
| 289 | + } |
| 290 | + |
| 291 | + @Override |
| 292 | + public String toString() { |
| 293 | + StringBuilder sb = new StringBuilder("AuthenticationException("); |
| 294 | + boolean first = true; |
| 295 | + |
| 296 | + sb.append("why:"); |
| 297 | + if (this.why == null) { |
| 298 | + sb.append("null"); |
| 299 | + } else { |
| 300 | + sb.append(this.why); |
| 301 | + } |
| 302 | + first = false; |
| 303 | + sb.append(")"); |
| 304 | + return sb.toString(); |
| 305 | + } |
| 306 | + |
| 307 | + public void validate() throws TException { |
| 308 | + // check for required fields |
| 309 | + if (why == null) { |
| 310 | + throw new TProtocolException("Required field 'why' was not present! Struct: " + toString()); |
| 311 | + } |
| 312 | + } |
| 313 | + |
| 314 | +} |
| 315 | + |
0 commit comments