Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.xiaomi.infra.galaxy.rpc.thrift.AuthService Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.rpc.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-4-7")
public class AuthService {
/**
* 授权相关接口(目前尚未开放)
*/
public interface Iface extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Iface {
/**
* 通过第三方认证系统换发Storage Access Token,采用App Secret登录无需此过程
*
* @param xiaomiAppId
* @param appUserAuthProvider
* @param authToken
*/
public Credential createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException;
}
public interface AsyncIface extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService .AsyncIface {
public void createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException;
}
public static class Client extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Client implements Iface {
public static class Factory implements libthrift091.TServiceClientFactory {
public Factory() {}
public Client getClient(libthrift091.protocol.TProtocol prot) {
return new Client(prot);
}
public Client getClient(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
return new Client(iprot, oprot);
}
}
public Client(libthrift091.protocol.TProtocol prot)
{
super(prot, prot);
}
public Client(libthrift091.protocol.TProtocol iprot, libthrift091.protocol.TProtocol oprot) {
super(iprot, oprot);
}
public Credential createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException
{
send_createCredential(xiaomiAppId, appUserAuthProvider, authToken);
return recv_createCredential();
}
public void send_createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken) throws libthrift091.TException
{
createCredential_args args = new createCredential_args();
args.setXiaomiAppId(xiaomiAppId);
args.setAppUserAuthProvider(appUserAuthProvider);
args.setAuthToken(authToken);
sendBase("createCredential", args);
}
public Credential recv_createCredential() throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException
{
createCredential_result result = new createCredential_result();
receiveBase(result, "createCredential");
if (result.isSetSuccess()) {
return result.success;
}
if (result.se != null) {
throw result.se;
}
throw new libthrift091.TApplicationException(libthrift091.TApplicationException.MISSING_RESULT, "createCredential failed: unknown result");
}
}
public static class AsyncClient extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.AsyncClient implements AsyncIface {
public static class Factory implements libthrift091.async.TAsyncClientFactory {
private libthrift091.async.TAsyncClientManager clientManager;
private libthrift091.protocol.TProtocolFactory protocolFactory;
public Factory(libthrift091.async.TAsyncClientManager clientManager, libthrift091.protocol.TProtocolFactory protocolFactory) {
this.clientManager = clientManager;
this.protocolFactory = protocolFactory;
}
public AsyncClient getAsyncClient(libthrift091.transport.TNonblockingTransport transport) {
return new AsyncClient(protocolFactory, clientManager, transport);
}
}
public AsyncClient(libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.async.TAsyncClientManager clientManager, libthrift091.transport.TNonblockingTransport transport) {
super(protocolFactory, clientManager, transport);
}
public void createCredential(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler) throws libthrift091.TException {
checkReady();
createCredential_call method_call = new createCredential_call(xiaomiAppId, appUserAuthProvider, authToken, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class createCredential_call extends libthrift091.async.TAsyncMethodCall {
private String xiaomiAppId;
private AppUserAuthProvider appUserAuthProvider;
private String authToken;
public createCredential_call(String xiaomiAppId, AppUserAuthProvider appUserAuthProvider, String authToken, libthrift091.async.AsyncMethodCallback resultHandler, libthrift091.async.TAsyncClient client, libthrift091.protocol.TProtocolFactory protocolFactory, libthrift091.transport.TNonblockingTransport transport) throws libthrift091.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.xiaomiAppId = xiaomiAppId;
this.appUserAuthProvider = appUserAuthProvider;
this.authToken = authToken;
}
public void write_args(libthrift091.protocol.TProtocol prot) throws libthrift091.TException {
prot.writeMessageBegin(new libthrift091.protocol.TMessage("createCredential", libthrift091.protocol.TMessageType.CALL, 0));
createCredential_args args = new createCredential_args();
args.setXiaomiAppId(xiaomiAppId);
args.setAppUserAuthProvider(appUserAuthProvider);
args.setAuthToken(authToken);
args.write(prot);
prot.writeMessageEnd();
}
public Credential getResult() throws com.xiaomi.infra.galaxy.rpc.thrift.ServiceException, libthrift091.TException {
if (getState() != libthrift091.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
libthrift091.transport.TMemoryInputTransport memoryTransport = new libthrift091.transport.TMemoryInputTransport(getFrameBuffer().array());
libthrift091.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_createCredential();
}
}
}
public static class Processor extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.Processor implements libthrift091.TProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
public Processor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected Processor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.ProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
protected boolean isOneway() {
return false;
}
public createCredential_result getResult(I iface, createCredential_args args) throws libthrift091.TException {
createCredential_result result = new createCredential_result();
try {
result.success = iface.createCredential(args.xiaomiAppId, args.appUserAuthProvider, args.authToken);
} catch (com.xiaomi.infra.galaxy.rpc.thrift.ServiceException se) {
result.se = se;
}
return result;
}
}
}
public static class AsyncProcessor extends com.xiaomi.infra.galaxy.rpc.thrift.BaseService.AsyncProcessor {
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());
public AsyncProcessor(I iface) {
super(iface, getProcessMap(new HashMap>()));
}
protected AsyncProcessor(I iface, Map> processMap) {
super(iface, getProcessMap(processMap));
}
private static Map> getProcessMap(Map> processMap) {
processMap.put("createCredential", new createCredential());
return processMap;
}
public static class createCredential extends libthrift091.AsyncProcessFunction {
public createCredential() {
super("createCredential");
}
public createCredential_args getEmptyArgsInstance() {
return new createCredential_args();
}
public AsyncMethodCallback getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final libthrift091.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback() {
public void onComplete(Credential o) {
createCredential_result result = new createCredential_result();
result.success = o;
try {
fcall.sendResponse(fb,result, libthrift091.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = libthrift091.protocol.TMessageType.REPLY;
libthrift091.TBase msg;
createCredential_result result = new createCredential_result();
if (e instanceof com.xiaomi.infra.galaxy.rpc.thrift.ServiceException) {
result.se = (com.xiaomi.infra.galaxy.rpc.thrift.ServiceException) e;
result.setSeIsSet(true);
msg = result;
}
else
{
msgType = libthrift091.protocol.TMessageType.EXCEPTION;
msg = (libthrift091.TBase)new libthrift091.TApplicationException(libthrift091.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, createCredential_args args, libthrift091.async.AsyncMethodCallback resultHandler) throws TException {
iface.createCredential(args.xiaomiAppId, args.appUserAuthProvider, args.authToken,resultHandler);
}
}
}
public static class createCredential_args implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("createCredential_args");
private static final libthrift091.protocol.TField XIAOMI_APP_ID_FIELD_DESC = new libthrift091.protocol.TField("xiaomiAppId", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField APP_USER_AUTH_PROVIDER_FIELD_DESC = new libthrift091.protocol.TField("appUserAuthProvider", libthrift091.protocol.TType.I32, (short)2);
private static final libthrift091.protocol.TField AUTH_TOKEN_FIELD_DESC = new libthrift091.protocol.TField("authToken", libthrift091.protocol.TType.STRING, (short)3);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createCredential_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new createCredential_argsTupleSchemeFactory());
}
public String xiaomiAppId; // required
/**
*
* @see AppUserAuthProvider
*/
public AppUserAuthProvider appUserAuthProvider; // required
public String authToken; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
XIAOMI_APP_ID((short)1, "xiaomiAppId"),
/**
*
* @see AppUserAuthProvider
*/
APP_USER_AUTH_PROVIDER((short)2, "appUserAuthProvider"),
AUTH_TOKEN((short)3, "authToken");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // XIAOMI_APP_ID
return XIAOMI_APP_ID;
case 2: // APP_USER_AUTH_PROVIDER
return APP_USER_AUTH_PROVIDER;
case 3: // AUTH_TOKEN
return AUTH_TOKEN;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.XIAOMI_APP_ID, new libthrift091.meta_data.FieldMetaData("xiaomiAppId", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.APP_USER_AUTH_PROVIDER, new libthrift091.meta_data.FieldMetaData("appUserAuthProvider", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.EnumMetaData(libthrift091.protocol.TType.ENUM, AppUserAuthProvider.class)));
tmpMap.put(_Fields.AUTH_TOKEN, new libthrift091.meta_data.FieldMetaData("authToken", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(createCredential_args.class, metaDataMap);
}
public createCredential_args() {
}
public createCredential_args(
String xiaomiAppId,
AppUserAuthProvider appUserAuthProvider,
String authToken)
{
this();
this.xiaomiAppId = xiaomiAppId;
this.appUserAuthProvider = appUserAuthProvider;
this.authToken = authToken;
}
/**
* Performs a deep copy on other .
*/
public createCredential_args(createCredential_args other) {
if (other.isSetXiaomiAppId()) {
this.xiaomiAppId = other.xiaomiAppId;
}
if (other.isSetAppUserAuthProvider()) {
this.appUserAuthProvider = other.appUserAuthProvider;
}
if (other.isSetAuthToken()) {
this.authToken = other.authToken;
}
}
public createCredential_args deepCopy() {
return new createCredential_args(this);
}
@Override
public void clear() {
this.xiaomiAppId = null;
this.appUserAuthProvider = null;
this.authToken = null;
}
public String getXiaomiAppId() {
return this.xiaomiAppId;
}
public createCredential_args setXiaomiAppId(String xiaomiAppId) {
this.xiaomiAppId = xiaomiAppId;
return this;
}
public void unsetXiaomiAppId() {
this.xiaomiAppId = null;
}
/** Returns true if field xiaomiAppId is set (has been assigned a value) and false otherwise */
public boolean isSetXiaomiAppId() {
return this.xiaomiAppId != null;
}
public void setXiaomiAppIdIsSet(boolean value) {
if (!value) {
this.xiaomiAppId = null;
}
}
/**
*
* @see AppUserAuthProvider
*/
public AppUserAuthProvider getAppUserAuthProvider() {
return this.appUserAuthProvider;
}
/**
*
* @see AppUserAuthProvider
*/
public createCredential_args setAppUserAuthProvider(AppUserAuthProvider appUserAuthProvider) {
this.appUserAuthProvider = appUserAuthProvider;
return this;
}
public void unsetAppUserAuthProvider() {
this.appUserAuthProvider = null;
}
/** Returns true if field appUserAuthProvider is set (has been assigned a value) and false otherwise */
public boolean isSetAppUserAuthProvider() {
return this.appUserAuthProvider != null;
}
public void setAppUserAuthProviderIsSet(boolean value) {
if (!value) {
this.appUserAuthProvider = null;
}
}
public String getAuthToken() {
return this.authToken;
}
public createCredential_args setAuthToken(String authToken) {
this.authToken = authToken;
return this;
}
public void unsetAuthToken() {
this.authToken = null;
}
/** Returns true if field authToken is set (has been assigned a value) and false otherwise */
public boolean isSetAuthToken() {
return this.authToken != null;
}
public void setAuthTokenIsSet(boolean value) {
if (!value) {
this.authToken = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case XIAOMI_APP_ID:
if (value == null) {
unsetXiaomiAppId();
} else {
setXiaomiAppId((String)value);
}
break;
case APP_USER_AUTH_PROVIDER:
if (value == null) {
unsetAppUserAuthProvider();
} else {
setAppUserAuthProvider((AppUserAuthProvider)value);
}
break;
case AUTH_TOKEN:
if (value == null) {
unsetAuthToken();
} else {
setAuthToken((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case XIAOMI_APP_ID:
return getXiaomiAppId();
case APP_USER_AUTH_PROVIDER:
return getAppUserAuthProvider();
case AUTH_TOKEN:
return getAuthToken();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case XIAOMI_APP_ID:
return isSetXiaomiAppId();
case APP_USER_AUTH_PROVIDER:
return isSetAppUserAuthProvider();
case AUTH_TOKEN:
return isSetAuthToken();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof createCredential_args)
return this.equals((createCredential_args)that);
return false;
}
public boolean equals(createCredential_args that) {
if (that == null)
return false;
boolean this_present_xiaomiAppId = true && this.isSetXiaomiAppId();
boolean that_present_xiaomiAppId = true && that.isSetXiaomiAppId();
if (this_present_xiaomiAppId || that_present_xiaomiAppId) {
if (!(this_present_xiaomiAppId && that_present_xiaomiAppId))
return false;
if (!this.xiaomiAppId.equals(that.xiaomiAppId))
return false;
}
boolean this_present_appUserAuthProvider = true && this.isSetAppUserAuthProvider();
boolean that_present_appUserAuthProvider = true && that.isSetAppUserAuthProvider();
if (this_present_appUserAuthProvider || that_present_appUserAuthProvider) {
if (!(this_present_appUserAuthProvider && that_present_appUserAuthProvider))
return false;
if (!this.appUserAuthProvider.equals(that.appUserAuthProvider))
return false;
}
boolean this_present_authToken = true && this.isSetAuthToken();
boolean that_present_authToken = true && that.isSetAuthToken();
if (this_present_authToken || that_present_authToken) {
if (!(this_present_authToken && that_present_authToken))
return false;
if (!this.authToken.equals(that.authToken))
return false;
}
return true;
}
@Override
public int hashCode() {
List list = new ArrayList();
boolean present_xiaomiAppId = true && (isSetXiaomiAppId());
list.add(present_xiaomiAppId);
if (present_xiaomiAppId)
list.add(xiaomiAppId);
boolean present_appUserAuthProvider = true && (isSetAppUserAuthProvider());
list.add(present_appUserAuthProvider);
if (present_appUserAuthProvider)
list.add(appUserAuthProvider.getValue());
boolean present_authToken = true && (isSetAuthToken());
list.add(present_authToken);
if (present_authToken)
list.add(authToken);
return list.hashCode();
}
@Override
public int compareTo(createCredential_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetXiaomiAppId()).compareTo(other.isSetXiaomiAppId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetXiaomiAppId()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.xiaomiAppId, other.xiaomiAppId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAppUserAuthProvider()).compareTo(other.isSetAppUserAuthProvider());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAppUserAuthProvider()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.appUserAuthProvider, other.appUserAuthProvider);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAuthToken()).compareTo(other.isSetAuthToken());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAuthToken()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.authToken, other.authToken);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("createCredential_args(");
boolean first = true;
sb.append("xiaomiAppId:");
if (this.xiaomiAppId == null) {
sb.append("null");
} else {
sb.append(this.xiaomiAppId);
}
first = false;
if (!first) sb.append(", ");
sb.append("appUserAuthProvider:");
if (this.appUserAuthProvider == null) {
sb.append("null");
} else {
sb.append(this.appUserAuthProvider);
}
first = false;
if (!first) sb.append(", ");
sb.append("authToken:");
if (this.authToken == null) {
sb.append("null");
} else {
sb.append(this.authToken);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws libthrift091.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private static class createCredential_argsStandardSchemeFactory implements SchemeFactory {
public createCredential_argsStandardScheme getScheme() {
return new createCredential_argsStandardScheme();
}
}
private static class createCredential_argsStandardScheme extends StandardScheme {
public void read(libthrift091.protocol.TProtocol iprot, createCredential_args struct) throws libthrift091.TException {
libthrift091.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == libthrift091.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // XIAOMI_APP_ID
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.xiaomiAppId = iprot.readString();
struct.setXiaomiAppIdIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // APP_USER_AUTH_PROVIDER
if (schemeField.type == libthrift091.protocol.TType.I32) {
struct.appUserAuthProvider = com.xiaomi.infra.galaxy.rpc.thrift.AppUserAuthProvider.findByValue(iprot.readI32());
struct.setAppUserAuthProviderIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // AUTH_TOKEN
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.authToken = iprot.readString();
struct.setAuthTokenIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(libthrift091.protocol.TProtocol oprot, createCredential_args struct) throws libthrift091.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.xiaomiAppId != null) {
oprot.writeFieldBegin(XIAOMI_APP_ID_FIELD_DESC);
oprot.writeString(struct.xiaomiAppId);
oprot.writeFieldEnd();
}
if (struct.appUserAuthProvider != null) {
oprot.writeFieldBegin(APP_USER_AUTH_PROVIDER_FIELD_DESC);
oprot.writeI32(struct.appUserAuthProvider.getValue());
oprot.writeFieldEnd();
}
if (struct.authToken != null) {
oprot.writeFieldBegin(AUTH_TOKEN_FIELD_DESC);
oprot.writeString(struct.authToken);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class createCredential_argsTupleSchemeFactory implements SchemeFactory {
public createCredential_argsTupleScheme getScheme() {
return new createCredential_argsTupleScheme();
}
}
private static class createCredential_argsTupleScheme extends TupleScheme {
@Override
public void write(libthrift091.protocol.TProtocol prot, createCredential_args struct) throws libthrift091.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetXiaomiAppId()) {
optionals.set(0);
}
if (struct.isSetAppUserAuthProvider()) {
optionals.set(1);
}
if (struct.isSetAuthToken()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetXiaomiAppId()) {
oprot.writeString(struct.xiaomiAppId);
}
if (struct.isSetAppUserAuthProvider()) {
oprot.writeI32(struct.appUserAuthProvider.getValue());
}
if (struct.isSetAuthToken()) {
oprot.writeString(struct.authToken);
}
}
@Override
public void read(libthrift091.protocol.TProtocol prot, createCredential_args struct) throws libthrift091.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.xiaomiAppId = iprot.readString();
struct.setXiaomiAppIdIsSet(true);
}
if (incoming.get(1)) {
struct.appUserAuthProvider = com.xiaomi.infra.galaxy.rpc.thrift.AppUserAuthProvider.findByValue(iprot.readI32());
struct.setAppUserAuthProviderIsSet(true);
}
if (incoming.get(2)) {
struct.authToken = iprot.readString();
struct.setAuthTokenIsSet(true);
}
}
}
}
public static class createCredential_result implements libthrift091.TBase, java.io.Serializable, Cloneable, Comparable {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("createCredential_result");
private static final libthrift091.protocol.TField SUCCESS_FIELD_DESC = new libthrift091.protocol.TField("success", libthrift091.protocol.TType.STRUCT, (short)0);
private static final libthrift091.protocol.TField SE_FIELD_DESC = new libthrift091.protocol.TField("se", libthrift091.protocol.TType.STRUCT, (short)1);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new createCredential_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new createCredential_resultTupleSchemeFactory());
}
public Credential success; // required
public com.xiaomi.infra.galaxy.rpc.thrift.ServiceException se; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
SUCCESS((short)0, "success"),
SE((short)1, "se");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
case 1: // SE
return SE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new libthrift091.meta_data.FieldMetaData("success", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.StructMetaData(libthrift091.protocol.TType.STRUCT, Credential.class)));
tmpMap.put(_Fields.SE, new libthrift091.meta_data.FieldMetaData("se", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(createCredential_result.class, metaDataMap);
}
public createCredential_result() {
}
public createCredential_result(
Credential success,
com.xiaomi.infra.galaxy.rpc.thrift.ServiceException se)
{
this();
this.success = success;
this.se = se;
}
/**
* Performs a deep copy on other .
*/
public createCredential_result(createCredential_result other) {
if (other.isSetSuccess()) {
this.success = new Credential(other.success);
}
if (other.isSetSe()) {
this.se = new com.xiaomi.infra.galaxy.rpc.thrift.ServiceException(other.se);
}
}
public createCredential_result deepCopy() {
return new createCredential_result(this);
}
@Override
public void clear() {
this.success = null;
this.se = null;
}
public Credential getSuccess() {
return this.success;
}
public createCredential_result setSuccess(Credential success) {
this.success = success;
return this;
}
public void unsetSuccess() {
this.success = null;
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
return this.success != null;
}
public void setSuccessIsSet(boolean value) {
if (!value) {
this.success = null;
}
}
public com.xiaomi.infra.galaxy.rpc.thrift.ServiceException getSe() {
return this.se;
}
public createCredential_result setSe(com.xiaomi.infra.galaxy.rpc.thrift.ServiceException se) {
this.se = se;
return this;
}
public void unsetSe() {
this.se = null;
}
/** Returns true if field se is set (has been assigned a value) and false otherwise */
public boolean isSetSe() {
return this.se != null;
}
public void setSeIsSet(boolean value) {
if (!value) {
this.se = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((Credential)value);
}
break;
case SE:
if (value == null) {
unsetSe();
} else {
setSe((com.xiaomi.infra.galaxy.rpc.thrift.ServiceException)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return getSuccess();
case SE:
return getSe();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SUCCESS:
return isSetSuccess();
case SE:
return isSetSe();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof createCredential_result)
return this.equals((createCredential_result)that);
return false;
}
public boolean equals(createCredential_result that) {
if (that == null)
return false;
boolean this_present_success = true && this.isSetSuccess();
boolean that_present_success = true && that.isSetSuccess();
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (!this.success.equals(that.success))
return false;
}
boolean this_present_se = true && this.isSetSe();
boolean that_present_se = true && that.isSetSe();
if (this_present_se || that_present_se) {
if (!(this_present_se && that_present_se))
return false;
if (!this.se.equals(that.se))
return false;
}
return true;
}
@Override
public int hashCode() {
List list = new ArrayList();
boolean present_success = true && (isSetSuccess());
list.add(present_success);
if (present_success)
list.add(success);
boolean present_se = true && (isSetSe());
list.add(present_se);
if (present_se)
list.add(se);
return list.hashCode();
}
@Override
public int compareTo(createCredential_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSe()).compareTo(other.isSetSe());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSe()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.se, other.se);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("createCredential_result(");
boolean first = true;
sb.append("success:");
if (this.success == null) {
sb.append("null");
} else {
sb.append(this.success);
}
first = false;
if (!first) sb.append(", ");
sb.append("se:");
if (this.se == null) {
sb.append("null");
} else {
sb.append(this.se);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws libthrift091.TException {
// check for required fields
// check for sub-struct validity
if (success != null) {
success.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private static class createCredential_resultStandardSchemeFactory implements SchemeFactory {
public createCredential_resultStandardScheme getScheme() {
return new createCredential_resultStandardScheme();
}
}
private static class createCredential_resultStandardScheme extends StandardScheme {
public void read(libthrift091.protocol.TProtocol iprot, createCredential_result struct) throws libthrift091.TException {
libthrift091.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == libthrift091.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 0: // SUCCESS
if (schemeField.type == libthrift091.protocol.TType.STRUCT) {
struct.success = new Credential();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 1: // SE
if (schemeField.type == libthrift091.protocol.TType.STRUCT) {
struct.se = new com.xiaomi.infra.galaxy.rpc.thrift.ServiceException();
struct.se.read(iprot);
struct.setSeIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(libthrift091.protocol.TProtocol oprot, createCredential_result struct) throws libthrift091.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.success != null) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
struct.success.write(oprot);
oprot.writeFieldEnd();
}
if (struct.se != null) {
oprot.writeFieldBegin(SE_FIELD_DESC);
struct.se.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class createCredential_resultTupleSchemeFactory implements SchemeFactory {
public createCredential_resultTupleScheme getScheme() {
return new createCredential_resultTupleScheme();
}
}
private static class createCredential_resultTupleScheme extends TupleScheme {
@Override
public void write(libthrift091.protocol.TProtocol prot, createCredential_result struct) throws libthrift091.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
if (struct.isSetSe()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetSuccess()) {
struct.success.write(oprot);
}
if (struct.isSetSe()) {
struct.se.write(oprot);
}
}
@Override
public void read(libthrift091.protocol.TProtocol prot, createCredential_result struct) throws libthrift091.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.success = new Credential();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
}
if (incoming.get(1)) {
struct.se = new com.xiaomi.infra.galaxy.rpc.thrift.ServiceException();
struct.se.read(iprot);
struct.setSeIsSet(true);
}
}
}
}
}