001// Automatically generated by the Thrifty compiler; do not edit! 002// Generated on: 2020-11-05T09:22:38.127Z 003// Source: J:\facelog\facelog-service\IFaceLog.thrift at 37:1 004package net.gdface.facelog.client.thrift; 005 006import com.microsoft.thrifty.Adapter; 007import com.microsoft.thrifty.Struct; 008import com.microsoft.thrifty.StructBuilder; 009import com.microsoft.thrifty.TType; 010import com.microsoft.thrifty.ThriftField; 011import com.microsoft.thrifty.protocol.FieldMetadata; 012import com.microsoft.thrifty.protocol.Protocol; 013import com.microsoft.thrifty.util.ProtocolUtil; 014import java.io.IOException; 015import javax.annotation.Generated; 016 017@Generated( 018 value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator", 019 comments = "https://github.com/microsoft/thrifty" 020) 021public final class ServiceRuntimeException extends Exception implements Struct { 022 public static final Adapter<ServiceRuntimeException, Builder> ADAPTER = new ServiceRuntimeExceptionAdapter(); 023 024 @ThriftField( 025 fieldId = 1, 026 isOptional = true 027 ) 028 public final String message; 029 030 @ThriftField( 031 fieldId = 2, 032 isOptional = true 033 ) 034 public final String causeClass; 035 036 @ThriftField( 037 fieldId = 3, 038 isOptional = true 039 ) 040 public final String serviceStackTraceMessage; 041 042 @ThriftField( 043 fieldId = 4, 044 isOptional = true 045 ) 046 public final String causeFields; 047 048 @ThriftField( 049 fieldId = 5, 050 isRequired = true 051 ) 052 public final Integer type; 053 054 private ServiceRuntimeException(Builder builder) { 055 this.message = builder.message; 056 this.causeClass = builder.causeClass; 057 this.serviceStackTraceMessage = builder.serviceStackTraceMessage; 058 this.causeFields = builder.causeFields; 059 this.type = builder.type; 060 } 061 062 @Override 063 @SuppressWarnings({"StringEquality", "NumberEquality"}) 064 public boolean equals(Object other) { 065 if (this == other) return true; 066 if (other == null) return false; 067 if (!(other instanceof ServiceRuntimeException)) return false; 068 ServiceRuntimeException that = (ServiceRuntimeException) other; 069 return (this.message == that.message || (this.message != null && this.message.equals(that.message))) 070 && (this.causeClass == that.causeClass || (this.causeClass != null && this.causeClass.equals(that.causeClass))) 071 && (this.serviceStackTraceMessage == that.serviceStackTraceMessage || (this.serviceStackTraceMessage != null && this.serviceStackTraceMessage.equals(that.serviceStackTraceMessage))) 072 && (this.causeFields == that.causeFields || (this.causeFields != null && this.causeFields.equals(that.causeFields))) 073 && (this.type == that.type || this.type.equals(that.type)); 074 } 075 076 @Override 077 public int hashCode() { 078 int code = 16777619; 079 code ^= (this.message == null) ? 0 : this.message.hashCode(); 080 code *= 0x811c9dc5; 081 code ^= (this.causeClass == null) ? 0 : this.causeClass.hashCode(); 082 code *= 0x811c9dc5; 083 code ^= (this.serviceStackTraceMessage == null) ? 0 : this.serviceStackTraceMessage.hashCode(); 084 code *= 0x811c9dc5; 085 code ^= (this.causeFields == null) ? 0 : this.causeFields.hashCode(); 086 code *= 0x811c9dc5; 087 code ^= this.type.hashCode(); 088 code *= 0x811c9dc5; 089 return code; 090 } 091 092 @Override 093 public String toString() { 094 return "ServiceRuntimeException{message=" + this.message + ", causeClass=" + this.causeClass + ", serviceStackTraceMessage=" + this.serviceStackTraceMessage + ", causeFields=" + this.causeFields + ", type=" + this.type + "}"; 095 } 096 097 @Override 098 public void write(Protocol protocol) throws IOException { 099 ADAPTER.write(protocol, this); 100 } 101 102 public static final class Builder implements StructBuilder<ServiceRuntimeException> { 103 private String message; 104 105 private String causeClass; 106 107 private String serviceStackTraceMessage; 108 109 private String causeFields; 110 111 private Integer type; 112 113 public Builder() { 114 } 115 116 public Builder(ServiceRuntimeException struct) { 117 this.message = struct.message; 118 this.causeClass = struct.causeClass; 119 this.serviceStackTraceMessage = struct.serviceStackTraceMessage; 120 this.causeFields = struct.causeFields; 121 this.type = struct.type; 122 } 123 124 public Builder message(String message) { 125 this.message = message; 126 return this; 127 } 128 129 public Builder causeClass(String causeClass) { 130 this.causeClass = causeClass; 131 return this; 132 } 133 134 public Builder serviceStackTraceMessage(String serviceStackTraceMessage) { 135 this.serviceStackTraceMessage = serviceStackTraceMessage; 136 return this; 137 } 138 139 public Builder causeFields(String causeFields) { 140 this.causeFields = causeFields; 141 return this; 142 } 143 144 public Builder type(Integer type) { 145 if (type == null) { 146 throw new NullPointerException("Required field 'type' cannot be null"); 147 } 148 this.type = type; 149 return this; 150 } 151 152 @Override 153 public ServiceRuntimeException build() { 154 if (this.type == null) { 155 throw new IllegalStateException("Required field 'type' is missing"); 156 } 157 return new ServiceRuntimeException(this); 158 } 159 160 @Override 161 public void reset() { 162 this.message = null; 163 this.causeClass = null; 164 this.serviceStackTraceMessage = null; 165 this.causeFields = null; 166 this.type = null; 167 } 168 } 169 170 private static final class ServiceRuntimeExceptionAdapter implements Adapter<ServiceRuntimeException, Builder> { 171 @Override 172 public void write(Protocol protocol, ServiceRuntimeException struct) throws IOException { 173 protocol.writeStructBegin("ServiceRuntimeException"); 174 if (struct.message != null) { 175 protocol.writeFieldBegin("message", 1, TType.STRING); 176 protocol.writeString(struct.message); 177 protocol.writeFieldEnd(); 178 } 179 if (struct.causeClass != null) { 180 protocol.writeFieldBegin("causeClass", 2, TType.STRING); 181 protocol.writeString(struct.causeClass); 182 protocol.writeFieldEnd(); 183 } 184 if (struct.serviceStackTraceMessage != null) { 185 protocol.writeFieldBegin("serviceStackTraceMessage", 3, TType.STRING); 186 protocol.writeString(struct.serviceStackTraceMessage); 187 protocol.writeFieldEnd(); 188 } 189 if (struct.causeFields != null) { 190 protocol.writeFieldBegin("causeFields", 4, TType.STRING); 191 protocol.writeString(struct.causeFields); 192 protocol.writeFieldEnd(); 193 } 194 protocol.writeFieldBegin("type", 5, TType.I32); 195 protocol.writeI32(struct.type); 196 protocol.writeFieldEnd(); 197 protocol.writeFieldStop(); 198 protocol.writeStructEnd(); 199 } 200 201 @Override 202 public ServiceRuntimeException read(Protocol protocol, Builder builder) throws IOException { 203 protocol.readStructBegin(); 204 while (true) { 205 FieldMetadata field = protocol.readFieldBegin(); 206 if (field.typeId == TType.STOP) { 207 break; 208 } 209 switch (field.fieldId) { 210 case 1: { 211 if (field.typeId == TType.STRING) { 212 String value = protocol.readString(); 213 builder.message(value); 214 } else { 215 ProtocolUtil.skip(protocol, field.typeId); 216 } 217 } 218 break; 219 case 2: { 220 if (field.typeId == TType.STRING) { 221 String value = protocol.readString(); 222 builder.causeClass(value); 223 } else { 224 ProtocolUtil.skip(protocol, field.typeId); 225 } 226 } 227 break; 228 case 3: { 229 if (field.typeId == TType.STRING) { 230 String value = protocol.readString(); 231 builder.serviceStackTraceMessage(value); 232 } else { 233 ProtocolUtil.skip(protocol, field.typeId); 234 } 235 } 236 break; 237 case 4: { 238 if (field.typeId == TType.STRING) { 239 String value = protocol.readString(); 240 builder.causeFields(value); 241 } else { 242 ProtocolUtil.skip(protocol, field.typeId); 243 } 244 } 245 break; 246 case 5: { 247 if (field.typeId == TType.I32) { 248 int value = protocol.readI32(); 249 builder.type(value); 250 } else { 251 ProtocolUtil.skip(protocol, field.typeId); 252 } 253 } 254 break; 255 default: { 256 ProtocolUtil.skip(protocol, field.typeId); 257 } 258 break; 259 } 260 protocol.readFieldEnd(); 261 } 262 protocol.readStructEnd(); 263 return builder.build(); 264 } 265 266 @Override 267 public ServiceRuntimeException read(Protocol protocol) throws IOException { 268 return read(protocol, new Builder()); 269 } 270 } 271}