scray.service.qservice.thriftjava.ScrayTException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scray-client-jdbc Show documentation
Show all versions of scray-client-jdbc Show documentation
scray java code, which can be used from java and scala
/**
* generated by Scrooge ${project.version}
*/
package scray.service.qservice.thriftjava;
import com.twitter.scrooge.Option;
import com.twitter.scrooge.Utilities;
import com.twitter.scrooge.ThriftStruct;
import com.twitter.scrooge.ThriftStructCodec;
import com.twitter.scrooge.ThriftStructCodec3;
import org.apache.thrift.protocol.*;
import java.nio.ByteBuffer;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
/**
* Scray-level exceptions
*/
@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "2017-04-25T16:52:50.412+0200")
public class ScrayTException extends Exception implements ThriftStruct {
private static final TStruct STRUCT = new TStruct("ScrayTException");
private static final TField WhatField = new TField("what", TType.I32, (short) 1);
final int what;
private static final TField WhyField = new TField("why", TType.STRING, (short) 2);
final String why;
public static class Builder {
private int _what = 0;
private Boolean _got_what = false;
public Builder what(int value) {
this._what = value;
this._got_what = true;
return this;
}
public Builder unsetWhat() {
this._what = 0;
this._got_what = false;
return this;
}
private String _why = null;
private Boolean _got_why = false;
public Builder why(String value) {
this._why = value;
this._got_why = true;
return this;
}
public Builder unsetWhy() {
this._why = null;
this._got_why = false;
return this;
}
public ScrayTException build() {
return new ScrayTException(
this._what,
this._why );
}
}
public Builder copy() {
Builder builder = new Builder();
builder.what(this.what);
builder.why(this.why);
return builder;
}
public static ThriftStructCodec CODEC = new ThriftStructCodec3() {
@Override
public ScrayTException decode(TProtocol _iprot) throws org.apache.thrift.TException {
Builder builder = new Builder();
int what = 0;
String why = null;
Boolean _done = false;
_iprot.readStructBegin();
while (!_done) {
TField _field = _iprot.readFieldBegin();
if (_field.type == TType.STOP) {
_done = true;
} else {
switch (_field.id) {
case 1: /* what */
switch (_field.type) {
case TType.I32:
Integer what_item;
what_item = _iprot.readI32();
what = what_item;
break;
default:
TProtocolUtil.skip(_iprot, _field.type);
}
builder.what(what);
break;
case 2: /* why */
switch (_field.type) {
case TType.STRING:
String why_item;
why_item = _iprot.readString();
why = why_item;
break;
default:
TProtocolUtil.skip(_iprot, _field.type);
}
builder.why(why);
break;
default:
TProtocolUtil.skip(_iprot, _field.type);
}
_iprot.readFieldEnd();
}
}
_iprot.readStructEnd();
try {
return builder.build();
} catch (IllegalStateException stateEx) {
throw new TProtocolException(stateEx.getMessage());
}
}
@Override
public void encode(ScrayTException struct, TProtocol oprot) throws org.apache.thrift.TException {
struct.write(oprot);
}
};
public static ScrayTException decode(TProtocol _iprot) throws org.apache.thrift.TException {
return CODEC.decode(_iprot);
}
public static void encode(ScrayTException struct, TProtocol oprot) throws org.apache.thrift.TException {
CODEC.encode(struct, oprot);
}
public ScrayTException(
int what,
String why
) {
this.what = what;
this.why = why;
}
public int getWhat() {
return this.what;
}
public String getWhy() {
return this.why;
}
public boolean isSetWhy() {
return this.why != null;
}
public void write(TProtocol _oprot) throws org.apache.thrift.TException {
validate();
_oprot.writeStructBegin(STRUCT);
_oprot.writeFieldBegin(WhatField);
Integer what_item = what;
_oprot.writeI32(what_item);
_oprot.writeFieldEnd();
_oprot.writeFieldBegin(WhyField);
String why_item = why;
_oprot.writeString(why_item);
_oprot.writeFieldEnd();
_oprot.writeFieldStop();
_oprot.writeStructEnd();
}
private void validate() throws org.apache.thrift.protocol.TProtocolException {
}
@Override
public String getMessage() {
return String.valueOf(why);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof ScrayTException)) return false;
ScrayTException that = (ScrayTException) other;
return
this.what == that.what &&
this.why.equals(that.why)
;
}
@Override
public String toString() {
return "ScrayTException(" + this.what + "," + this.why + ")";
}
@Override
public int hashCode() {
int hash = 1;
hash = hash * new Integer(this.what).hashCode();
hash = hash * (this.why == null ? 0 : this.why.hashCode());
return hash;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy