thrift

thrift

thrift简介

  • The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
  • 用于可扩展跨语言服务开发的Apache Thrift软件框架将软件堆栈与代码生成引擎相结合,以构建可在C ++,Java,Python,PHP,Ruby,Erlang,Perl,Haskell,C# Cocoa,JavaScript,Node.js,Smalltalk,OCaml和Delphi等语言。

关键

  • 编写thrift文件(约定)
  • 服务端实现thrift生成的接口和主类开启服务
  • 客户端调用

用法

  1. 编写一个thirft文件作为桥梁文件

    namespace java com.user
    
    struct User {
        1: i64 id;
        2: i64 create_time;
        3: i64 modify_time;
    
        4: string username;
        5: string password;
    
        6: string openid;
        7: string nickname;
        8: i32 sex;
        9: string province;
        10: string city;
        11: string country;
        12: string headimgurl;
        13: string unionid;
    }
    
    service UserService{
        string login(1:string username, 2:string password);
        User registerUser(1:string username, 2:string password);
    
        string weixinLogin(1:string access_token);
    
        User getUser(1:string token);
    }
    
  2. 生成对应的语言文件【java为例】【进入cmd下执行thrift-0.9.3 -r -gen java user.thrift】

    • User类

    /**
     * Autogenerated by Thrift Compiler (0.11.0)
     *
     * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
     *  @generated
     */
    
    @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
    @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-04-09")
    public class User implements org.apache.thrift.TBase<User, User._Fields>, java.io.Serializable, Cloneable, Comparable<User> {
      private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("User");
    
      private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
      private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("create_time", org.apache.thrift.protocol.TType.I64, (short)2);
      private static final org.apache.thrift.protocol.TField MODIFY_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("modify_time", org.apache.thrift.protocol.TType.I64, (short)3);
      private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)4);
      private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)5);
      private static final org.apache.thrift.protocol.TField OPENID_FIELD_DESC = new org.apache.thrift.protocol.TField("openid", org.apache.thrift.protocol.TType.STRING, (short)6);
      private static final org.apache.thrift.protocol.TField NICKNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("nickname", org.apache.thrift.protocol.TType.STRING, (short)7);
      private static final org.apache.thrift.protocol.TField SEX_FIELD_DESC = new org.apache.thrift.protocol.TField("sex", org.apache.thrift.protocol.TType.I32, (short)8);
      private static final org.apache.thrift.protocol.TField PROVINCE_FIELD_DESC = new org.apache.thrift.protocol.TField("province", org.apache.thrift.protocol.TType.STRING, (short)9);
      private static final org.apache.thrift.protocol.TField CITY_FIELD_DESC = new org.apache.thrift.protocol.TField("city", org.apache.thrift.protocol.TType.STRING, (short)10);
      private static final org.apache.thrift.protocol.TField COUNTRY_FIELD_DESC = new org.apache.thrift.protocol.TField("country", org.apache.thrift.protocol.TType.STRING, (short)11);
      private static final org.apache.thrift.protocol.TField HEADIMGURL_FIELD_DESC = new org.apache.thrift.protocol.TField("headimgurl", org.apache.thrift.protocol.TType.STRING, (short)12);
      private static final org.apache.thrift.protocol.TField UNIONID_FIELD_DESC = new org.apache.thrift.protocol.TField("unionid", org.apache.thrift.protocol.TType.STRING, (short)13);
    
      private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new UserStandardSchemeFactory();
      private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new UserTupleSchemeFactory();
    
      public long id; // required
      public long create_time; // required
      public long modify_time; // required
      public java.lang.String username; // required
      public java.lang.String password; // required
      public java.lang.String openid; // required
      public java.lang.String nickname; // required
      public int sex; // required
      public java.lang.String province; // required
      public java.lang.String city; // required
      public java.lang.String country; // required
      public java.lang.String headimgurl; // required
      public java.lang.String unionid; // required
    
      /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
      public enum _Fields implements org.apache.thrift.TFieldIdEnum {
        ID((short)1, "id"),
        CREATE_TIME((short)2, "create_time"),
        MODIFY_TIME((short)3, "modify_time"),
        USERNAME((short)4, "username"),
        PASSWORD((short)5, "password"),
        OPENID((short)6, "openid"),
        NICKNAME((short)7, "nickname"),
        SEX((short)8, "sex"),
        PROVINCE((short)9, "province"),
        CITY((short)10, "city"),
        COUNTRY((short)11, "country"),
        HEADIMGURL((short)12, "headimgurl"),
        UNIONID((short)13, "unionid");
    
        private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
    
        static {
          for (_Fields field : java.util.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: // ID
              return ID;
            case 2: // CREATE_TIME
              return CREATE_TIME;
            case 3: // MODIFY_TIME
              return MODIFY_TIME;
            case 4: // USERNAME
              return USERNAME;
            case 5: // PASSWORD
              return PASSWORD;
            case 6: // OPENID
              return OPENID;
            case 7: // NICKNAME
              return NICKNAME;
            case 8: // SEX
              return SEX;
            case 9: // PROVINCE
              return PROVINCE;
            case 10: // CITY
              return CITY;
            case 11: // COUNTRY
              return COUNTRY;
            case 12: // HEADIMGURL
              return HEADIMGURL;
            case 13: // UNIONID
              return UNIONID;
            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 java.lang.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(java.lang.String name) {
          return byName.get(name);
        }
    
        private final short _thriftId;
        private final java.lang.String _fieldName;
    
        _Fields(short thriftId, java.lang.String fieldName) {
          _thriftId = thriftId;
          _fieldName = fieldName;
        }
    
        public short getThriftFieldId() {
          return _thriftId;
        }
    
        public java.lang.String getFieldName() {
          return _fieldName;
        }
      }
    
      // isset id assignments
      private static final int __ID_ISSET_ID = 0;
      private static final int __CREATE_TIME_ISSET_ID = 1;
      private static final int __MODIFY_TIME_ISSET_ID = 2;
      private static final int __SEX_ISSET_ID = 3;
      private byte __isset_bitfield = 0;
      public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
      static {
        java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
        tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("create_time", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.MODIFY_TIME, new org.apache.thrift.meta_data.FieldMetaData("modify_time", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.OPENID, new org.apache.thrift.meta_data.FieldMetaData("openid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.NICKNAME, new org.apache.thrift.meta_data.FieldMetaData("nickname", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.SEX, new org.apache.thrift.meta_data.FieldMetaData("sex", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.PROVINCE, new org.apache.thrift.meta_data.FieldMetaData("province", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.CITY, new org.apache.thrift.meta_data.FieldMetaData("city", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.COUNTRY, new org.apache.thrift.meta_data.FieldMetaData("country", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.HEADIMGURL, new org.apache.thrift.meta_data.FieldMetaData("headimgurl", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.UNIONID, new org.apache.thrift.meta_data.FieldMetaData("unionid", org.apache.thrift.TFieldRequirementType.DEFAULT, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap);
      }
    
      public User() {
      }
    
      public User(
        long id,
        long create_time,
        long modify_time,
        java.lang.String username,
        java.lang.String password,
        java.lang.String openid,
        java.lang.String nickname,
        int sex,
        java.lang.String province,
        java.lang.String city,
        java.lang.String country,
        java.lang.String headimgurl,
        java.lang.String unionid)
      {
        this();
        this.id = id;
        setIdIsSet(true);
        this.create_time = create_time;
        setCreate_timeIsSet(true);
        this.modify_time = modify_time;
        setModify_timeIsSet(true);
        this.username = username;
        this.password = password;
        this.openid = openid;
        this.nickname = nickname;
        this.sex = sex;
        setSexIsSet(true);
        this.province = province;
        this.city = city;
        this.country = country;
        this.headimgurl = headimgurl;
        this.unionid = unionid;
      }
    
      /**
       * Performs a deep copy on <i>other</i>.
       */
      public User(User other) {
        __isset_bitfield = other.__isset_bitfield;
        this.id = other.id;
        this.create_time = other.create_time;
        this.modify_time = other.modify_time;
        if (other.isSetUsername()) {
          this.username = other.username;
        }
        if (other.isSetPassword()) {
          this.password = other.password;
        }
        if (other.isSetOpenid()) {
          this.openid = other.openid;
        }
        if (other.isSetNickname()) {
          this.nickname = other.nickname;
        }
        this.sex = other.sex;
        if (other.isSetProvince()) {
          this.province = other.province;
        }
        if (other.isSetCity()) {
          this.city = other.city;
        }
        if (other.isSetCountry()) {
          this.country = other.country;
        }
        if (other.isSetHeadimgurl()) {
          this.headimgurl = other.headimgurl;
        }
        if (other.isSetUnionid()) {
          this.unionid = other.unionid;
        }
      }
    
      public User deepCopy() {
        return new User(this);
      }
    
      @Override
      public void clear() {
        setIdIsSet(false);
        this.id = 0;
        setCreate_timeIsSet(false);
        this.create_time = 0;
        setModify_timeIsSet(false);
        this.modify_time = 0;
        this.username = null;
        this.password = null;
        this.openid = null;
        this.nickname = null;
        setSexIsSet(false);
        this.sex = 0;
        this.province = null;
        this.city = null;
        this.country = null;
        this.headimgurl = null;
        this.unionid = null;
      }
    
      public long getId() {
        return this.id;
      }
    
      public User setId(long id) {
        this.id = id;
        setIdIsSet(true);
        return this;
      }
    
      public void unsetId() {
        __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
      }
    
      /** Returns true if field id is set (has been assigned a value) and false otherwise */
      public boolean isSetId() {
        return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
      }
    
      public void setIdIsSet(boolean value) {
        __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
      }
    
      public long getCreate_time() {
        return this.create_time;
      }
    
      public User setCreate_time(long create_time) {
        this.create_time = create_time;
        setCreate_timeIsSet(true);
        return this;
      }
    
      public void unsetCreate_time() {
        __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __CREATE_TIME_ISSET_ID);
      }
    
      /** Returns true if field create_time is set (has been assigned a value) and false otherwise */
      public boolean isSetCreate_time() {
        return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __CREATE_TIME_ISSET_ID);
      }
    
      public void setCreate_timeIsSet(boolean value) {
        __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CREATE_TIME_ISSET_ID, value);
      }
    
      public long getModify_time() {
        return this.modify_time;
      }
    
      public User setModify_time(long modify_time) {
        this.modify_time = modify_time;
        setModify_timeIsSet(true);
        return this;
      }
    
      public void unsetModify_time() {
        __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __MODIFY_TIME_ISSET_ID);
      }
    
      /** Returns true if field modify_time is set (has been assigned a value) and false otherwise */
      public boolean isSetModify_time() {
        return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __MODIFY_TIME_ISSET_ID);
      }
    
      public void setModify_timeIsSet(boolean value) {
        __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __MODIFY_TIME_ISSET_ID, value);
      }
    
      public java.lang.String getUsername() {
        return this.username;
      }
    
      public User setUsername(java.lang.String username) {
        this.username = username;
        return this;
      }
    
      public void unsetUsername() {
        this.username = null;
      }
    
      /** Returns true if field username is set (has been assigned a value) and false otherwise */
      public boolean isSetUsername() {
        return this.username != null;
      }
    
      public void setUsernameIsSet(boolean value) {
        if (!value) {
          this.username = null;
        }
      }
    
      public java.lang.String getPassword() {
        return this.password;
      }
    
      public User setPassword(java.lang.String password) {
        this.password = password;
        return this;
      }
    
      public void unsetPassword() {
        this.password = null;
      }
    
      /** Returns true if field password is set (has been assigned a value) and false otherwise */
      public boolean isSetPassword() {
        return this.password != null;
      }
    
      public void setPasswordIsSet(boolean value) {
        if (!value) {
          this.password = null;
        }
      }
    
      public java.lang.String getOpenid() {
        return this.openid;
      }
    
      public User setOpenid(java.lang.String openid) {
        this.openid = openid;
        return this;
      }
    
      public void unsetOpenid() {
        this.openid = null;
      }
    
      /** Returns true if field openid is set (has been assigned a value) and false otherwise */
      public boolean isSetOpenid() {
        return this.openid != null;
      }
    
      public void setOpenidIsSet(boolean value) {
        if (!value) {
          this.openid = null;
        }
      }
    
      public java.lang.String getNickname() {
        return this.nickname;
      }
    
      public User setNickname(java.lang.String nickname) {
        this.nickname = nickname;
        return this;
      }
    
      public void unsetNickname() {
        this.nickname = null;
      }
    
      /** Returns true if field nickname is set (has been assigned a value) and false otherwise */
      public boolean isSetNickname() {
        return this.nickname != null;
      }
    
      public void setNicknameIsSet(boolean value) {
        if (!value) {
          this.nickname = null;
        }
      }
    
      public int getSex() {
        return this.sex;
      }
    
      public User setSex(int sex) {
        this.sex = sex;
        setSexIsSet(true);
        return this;
      }
    
      public void unsetSex() {
        __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SEX_ISSET_ID);
      }
    
      /** Returns true if field sex is set (has been assigned a value) and false otherwise */
      public boolean isSetSex() {
        return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SEX_ISSET_ID);
      }
    
      public void setSexIsSet(boolean value) {
        __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SEX_ISSET_ID, value);
      }
    
      public java.lang.String getProvince() {
        return this.province;
      }
    
      public User setProvince(java.lang.String province) {
        this.province = province;
        return this;
      }
    
      public void unsetProvince() {
        this.province = null;
      }
    
      /** Returns true if field province is set (has been assigned a value) and false otherwise */
      public boolean isSetProvince() {
        return this.province != null;
      }
    
      public void setProvinceIsSet(boolean value) {
        if (!value) {
          this.province = null;
        }
      }
    
      public java.lang.String getCity() {
        return this.city;
      }
    
      public User setCity(java.lang.String city) {
        this.city = city;
        return this;
      }
    
      public void unsetCity() {
        this.city = null;
      }
    
      /** Returns true if field city is set (has been assigned a value) and false otherwise */
      public boolean isSetCity() {
        return this.city != null;
      }
    
      public void setCityIsSet(boolean value) {
        if (!value) {
          this.city = null;
        }
      }
    
      public java.lang.String getCountry() {
        return this.country;
      }
    
      public User setCountry(java.lang.String country) {
        this.country = country;
        return this;
      }
    
      public void unsetCountry() {
        this.country = null;
      }
    
      /** Returns true if field country is set (has been assigned a value) and false otherwise */
      public boolean isSetCountry() {
        return this.country != null;
      }
    
      public void setCountryIsSet(boolean value) {
        if (!value) {
          this.country = null;
        }
      }
    
      public java.lang.String getHeadimgurl() {
        return this.headimgurl;
      }
    
      public User setHeadimgurl(java.lang.String headimgurl) {
        this.headimgurl = headimgurl;
        return this;
      }
    
      public void unsetHeadimgurl() {
        this.headimgurl = null;
      }
    
      /** Returns true if field headimgurl is set (has been assigned a value) and false otherwise */
      public boolean isSetHeadimgurl() {
        return this.headimgurl != null;
      }
    
      public void setHeadimgurlIsSet(boolean value) {
        if (!value) {
          this.headimgurl = null;
        }
      }
    
      public java.lang.String getUnionid() {
        return this.unionid;
      }
    
      public User setUnionid(java.lang.String unionid) {
        this.unionid = unionid;
        return this;
      }
    
      public void unsetUnionid() {
        this.unionid = null;
      }
    
      /** Returns true if field unionid is set (has been assigned a value) and false otherwise */
      public boolean isSetUnionid() {
        return this.unionid != null;
      }
    
      public void setUnionidIsSet(boolean value) {
        if (!value) {
          this.unionid = null;
        }
      }
    
      public void setFieldValue(_Fields field, java.lang.Object value) {
        switch (field) {
        case ID:
          if (value == null) {
            unsetId();
          } else {
            setId((java.lang.Long)value);
          }
          break;
    
        case CREATE_TIME:
          if (value == null) {
            unsetCreate_time();
          } else {
            setCreate_time((java.lang.Long)value);
          }
          break;
    
        case MODIFY_TIME:
          if (value == null) {
            unsetModify_time();
          } else {
            setModify_time((java.lang.Long)value);
          }
          break;
    
        case USERNAME:
          if (value == null) {
            unsetUsername();
          } else {
            setUsername((java.lang.String)value);
          }
          break;
    
        case PASSWORD:
          if (value == null) {
            unsetPassword();
          } else {
            setPassword((java.lang.String)value);
          }
          break;
    
        case OPENID:
          if (value == null) {
            unsetOpenid();
          } else {
            setOpenid((java.lang.String)value);
          }
          break;
    
        case NICKNAME:
          if (value == null) {
            unsetNickname();
          } else {
            setNickname((java.lang.String)value);
          }
          break;
    
        case SEX:
          if (value == null) {
            unsetSex();
          } else {
            setSex((java.lang.Integer)value);
          }
          break;
    
        case PROVINCE:
          if (value == null) {
            unsetProvince();
          } else {
            setProvince((java.lang.String)value);
          }
          break;
    
        case CITY:
          if (value == null) {
            unsetCity();
          } else {
            setCity((java.lang.String)value);
          }
          break;
    
        case COUNTRY:
          if (value == null) {
            unsetCountry();
          } else {
            setCountry((java.lang.String)value);
          }
          break;
    
        case HEADIMGURL:
          if (value == null) {
            unsetHeadimgurl();
          } else {
            setHeadimgurl((java.lang.String)value);
          }
          break;
    
        case UNIONID:
          if (value == null) {
            unsetUnionid();
          } else {
            setUnionid((java.lang.String)value);
          }
          break;
    
        }
      }
    
      public java.lang.Object getFieldValue(_Fields field) {
        switch (field) {
        case ID:
          return getId();
    
        case CREATE_TIME:
          return getCreate_time();
    
        case MODIFY_TIME:
          return getModify_time();
    
        case USERNAME:
          return getUsername();
    
        case PASSWORD:
          return getPassword();
    
        case OPENID:
          return getOpenid();
    
        case NICKNAME:
          return getNickname();
    
        case SEX:
          return getSex();
    
        case PROVINCE:
          return getProvince();
    
        case CITY:
          return getCity();
    
        case COUNTRY:
          return getCountry();
    
        case HEADIMGURL:
          return getHeadimgurl();
    
        case UNIONID:
          return getUnionid();
    
        }
        throw new java.lang.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 java.lang.IllegalArgumentException();
        }
    
        switch (field) {
        case ID:
          return isSetId();
        case CREATE_TIME:
          return isSetCreate_time();
        case MODIFY_TIME:
          return isSetModify_time();
        case USERNAME:
          return isSetUsername();
        case PASSWORD:
          return isSetPassword();
        case OPENID:
          return isSetOpenid();
        case NICKNAME:
          return isSetNickname();
        case SEX:
          return isSetSex();
        case PROVINCE:
          return isSetProvince();
        case CITY:
          return isSetCity();
        case COUNTRY:
          return isSetCountry();
        case HEADIMGURL:
          return isSetHeadimgurl();
        case UNIONID:
          return isSetUnionid();
        }
        throw new java.lang.IllegalStateException();
      }
    
      @Override
      public boolean equals(java.lang.Object that) {
        if (that == null)
          return false;
        if (that instanceof User)
          return this.equals((User)that);
        return false;
      }
    
      public boolean equals(User that) {
        if (that == null)
          return false;
        if (this == that)
          return true;
    
        boolean this_present_id = true;
        boolean that_present_id = true;
        if (this_present_id || that_present_id) {
          if (!(this_present_id && that_present_id))
            return false;
          if (this.id != that.id)
            return false;
        }
    
        boolean this_present_create_time = true;
        boolean that_present_create_time = true;
        if (this_present_create_time || that_present_create_time) {
          if (!(this_present_create_time && that_present_create_time))
            return false;
          if (this.create_time != that.create_time)
            return false;
        }
    
        boolean this_present_modify_time = true;
        boolean that_present_modify_time = true;
        if (this_present_modify_time || that_present_modify_time) {
          if (!(this_present_modify_time && that_present_modify_time))
            return false;
          if (this.modify_time != that.modify_time)
            return false;
        }
    
        boolean this_present_username = true && this.isSetUsername();
        boolean that_present_username = true && that.isSetUsername();
        if (this_present_username || that_present_username) {
          if (!(this_present_username && that_present_username))
            return false;
          if (!this.username.equals(that.username))
            return false;
        }
    
        boolean this_present_password = true && this.isSetPassword();
        boolean that_present_password = true && that.isSetPassword();
        if (this_present_password || that_present_password) {
          if (!(this_present_password && that_present_password))
            return false;
          if (!this.password.equals(that.password))
            return false;
        }
    
        boolean this_present_openid = true && this.isSetOpenid();
        boolean that_present_openid = true && that.isSetOpenid();
        if (this_present_openid || that_present_openid) {
          if (!(this_present_openid && that_present_openid))
            return false;
          if (!this.openid.equals(that.openid))
            return false;
        }
    
        boolean this_present_nickname = true && this.isSetNickname();
        boolean that_present_nickname = true && that.isSetNickname();
        if (this_present_nickname || that_present_nickname) {
          if (!(this_present_nickname && that_present_nickname))
            return false;
          if (!this.nickname.equals(that.nickname))
            return false;
        }
    
        boolean this_present_sex = true;
        boolean that_present_sex = true;
        if (this_present_sex || that_present_sex) {
          if (!(this_present_sex && that_present_sex))
            return false;
          if (this.sex != that.sex)
            return false;
        }
    
        boolean this_present_province = true && this.isSetProvince();
        boolean that_present_province = true && that.isSetProvince();
        if (this_present_province || that_present_province) {
          if (!(this_present_province && that_present_province))
            return false;
          if (!this.province.equals(that.province))
            return false;
        }
    
        boolean this_present_city = true && this.isSetCity();
        boolean that_present_city = true && that.isSetCity();
        if (this_present_city || that_present_city) {
          if (!(this_present_city && that_present_city))
            return false;
          if (!this.city.equals(that.city))
            return false;
        }
    
        boolean this_present_country = true && this.isSetCountry();
        boolean that_present_country = true && that.isSetCountry();
        if (this_present_country || that_present_country) {
          if (!(this_present_country && that_present_country))
            return false;
          if (!this.country.equals(that.country))
            return false;
        }
    
        boolean this_present_headimgurl = true && this.isSetHeadimgurl();
        boolean that_present_headimgurl = true && that.isSetHeadimgurl();
        if (this_present_headimgurl || that_present_headimgurl) {
          if (!(this_present_headimgurl && that_present_headimgurl))
            return false;
          if (!this.headimgurl.equals(that.headimgurl))
            return false;
        }
    
        boolean this_present_unionid = true && this.isSetUnionid();
        boolean that_present_unionid = true && that.isSetUnionid();
        if (this_present_unionid || that_present_unionid) {
          if (!(this_present_unionid && that_present_unionid))
            return false;
          if (!this.unionid.equals(that.unionid))
            return false;
        }
    
        return true;
      }
    
      @Override
      public int hashCode() {
        int hashCode = 1;
    
        hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);
    
        hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(create_time);
    
        hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(modify_time);
    
        hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
        if (isSetUsername())
          hashCode = hashCode * 8191 + username.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetPassword()) ? 131071 : 524287);
        if (isSetPassword())
          hashCode = hashCode * 8191 + password.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetOpenid()) ? 131071 : 524287);
        if (isSetOpenid())
          hashCode = hashCode * 8191 + openid.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetNickname()) ? 131071 : 524287);
        if (isSetNickname())
          hashCode = hashCode * 8191 + nickname.hashCode();
    
        hashCode = hashCode * 8191 + sex;
    
        hashCode = hashCode * 8191 + ((isSetProvince()) ? 131071 : 524287);
        if (isSetProvince())
          hashCode = hashCode * 8191 + province.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetCity()) ? 131071 : 524287);
        if (isSetCity())
          hashCode = hashCode * 8191 + city.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetCountry()) ? 131071 : 524287);
        if (isSetCountry())
          hashCode = hashCode * 8191 + country.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetHeadimgurl()) ? 131071 : 524287);
        if (isSetHeadimgurl())
          hashCode = hashCode * 8191 + headimgurl.hashCode();
    
        hashCode = hashCode * 8191 + ((isSetUnionid()) ? 131071 : 524287);
        if (isSetUnionid())
          hashCode = hashCode * 8191 + unionid.hashCode();
    
        return hashCode;
      }
    
      @Override
      public int compareTo(User other) {
        if (!getClass().equals(other.getClass())) {
          return getClass().getName().compareTo(other.getClass().getName());
        }
    
        int lastComparison = 0;
    
        lastComparison = java.lang.Boolean.valueOf(isSetId()).compareTo(other.isSetId());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetId()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetCreate_time()).compareTo(other.isSetCreate_time());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetCreate_time()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.create_time, other.create_time);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetModify_time()).compareTo(other.isSetModify_time());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetModify_time()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.modify_time, other.modify_time);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetUsername()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetPassword()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetOpenid()).compareTo(other.isSetOpenid());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetOpenid()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.openid, other.openid);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetNickname()).compareTo(other.isSetNickname());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetNickname()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nickname, other.nickname);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetSex()).compareTo(other.isSetSex());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetSex()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sex, other.sex);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetProvince()).compareTo(other.isSetProvince());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetProvince()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.province, other.province);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetCity()).compareTo(other.isSetCity());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetCity()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.city, other.city);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetCountry()).compareTo(other.isSetCountry());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetCountry()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.country, other.country);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetHeadimgurl()).compareTo(other.isSetHeadimgurl());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetHeadimgurl()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.headimgurl, other.headimgurl);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        lastComparison = java.lang.Boolean.valueOf(isSetUnionid()).compareTo(other.isSetUnionid());
        if (lastComparison != 0) {
          return lastComparison;
        }
        if (isSetUnionid()) {
          lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unionid, other.unionid);
          if (lastComparison != 0) {
            return lastComparison;
          }
        }
        return 0;
      }
    
      public _Fields fieldForId(int fieldId) {
        return _Fields.findByThriftId(fieldId);
      }
    
      public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
        scheme(iprot).read(iprot, this);
      }
    
      public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
        scheme(oprot).write(oprot, this);
      }
    
      @Override
      public java.lang.String toString() {
        java.lang.StringBuilder sb = new java.lang.StringBuilder("User(");
        boolean first = true;
    
        sb.append("id:");
        sb.append(this.id);
        first = false;
        if (!first) sb.append(", ");
        sb.append("create_time:");
        sb.append(this.create_time);
        first = false;
        if (!first) sb.append(", ");
        sb.append("modify_time:");
        sb.append(this.modify_time);
        first = false;
        if (!first) sb.append(", ");
        sb.append("username:");
        if (this.username == null) {
          sb.append("null");
        } else {
          sb.append(this.username);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("password:");
        if (this.password == null) {
          sb.append("null");
        } else {
          sb.append(this.password);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("openid:");
        if (this.openid == null) {
          sb.append("null");
        } else {
          sb.append(this.openid);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("nickname:");
        if (this.nickname == null) {
          sb.append("null");
        } else {
          sb.append(this.nickname);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("sex:");
        sb.append(this.sex);
        first = false;
        if (!first) sb.append(", ");
        sb.append("province:");
        if (this.province == null) {
          sb.append("null");
        } else {
          sb.append(this.province);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("city:");
        if (this.city == null) {
          sb.append("null");
        } else {
          sb.append(this.city);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("country:");
        if (this.country == null) {
          sb.append("null");
        } else {
          sb.append(this.country);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("headimgurl:");
        if (this.headimgurl == null) {
          sb.append("null");
        } else {
          sb.append(this.headimgurl);
        }
        first = false;
        if (!first) sb.append(", ");
        sb.append("unionid:");
        if (this.unionid == null) {
          sb.append("null");
        } else {
          sb.append(this.unionid);
        }
        first = false;
        sb.append(")");
        return sb.toString();
      }
    
      public void validate() throws org.apache.thrift.TException {
        // check for required fields
        // check for sub-struct validity
      }
    
      private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
        try {
          write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
        } catch (org.apache.thrift.TException te) {
          throw new java.io.IOException(te);
        }
      }
    
      private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
        try {
          // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
          __isset_bitfield = 0;
          read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
        } catch (org.apache.thrift.TException te) {
          throw new java.io.IOException(te);
        }
      }
    
      private static class UserStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
        public UserStandardScheme getScheme() {
          return new UserStandardScheme();
        }
      }
    
      private static class UserStandardScheme extends org.apache.thrift.scheme.StandardScheme<User> {
    
        public void read(org.apache.thrift.protocol.TProtocol iprot, User struct) throws org.apache.thrift.TException {
          org.apache.thrift.protocol.TField schemeField;
          iprot.readStructBegin();
          while (true)
          {
            schemeField = iprot.readFieldBegin();
            if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
              break;
            }
            switch (schemeField.id) {
              case 1: // ID
                if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                  struct.id = iprot.readI64();
                  struct.setIdIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 2: // CREATE_TIME
                if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                  struct.create_time = iprot.readI64();
                  struct.setCreate_timeIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 3: // MODIFY_TIME
                if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                  struct.modify_time = iprot.readI64();
                  struct.setModify_timeIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 4: // USERNAME
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.username = iprot.readString();
                  struct.setUsernameIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 5: // PASSWORD
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.password = iprot.readString();
                  struct.setPasswordIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 6: // OPENID
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.openid = iprot.readString();
                  struct.setOpenidIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 7: // NICKNAME
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.nickname = iprot.readString();
                  struct.setNicknameIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 8: // SEX
                if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                  struct.sex = iprot.readI32();
                  struct.setSexIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 9: // PROVINCE
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.province = iprot.readString();
                  struct.setProvinceIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 10: // CITY
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.city = iprot.readString();
                  struct.setCityIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 11: // COUNTRY
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.country = iprot.readString();
                  struct.setCountryIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 12: // HEADIMGURL
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.headimgurl = iprot.readString();
                  struct.setHeadimgurlIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              case 13: // UNIONID
                if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                  struct.unionid = iprot.readString();
                  struct.setUnionidIsSet(true);
                } else { 
                  org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                break;
              default:
                org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, User struct) throws org.apache.thrift.TException {
          struct.validate();
    
          oprot.writeStructBegin(STRUCT_DESC);
          oprot.writeFieldBegin(ID_FIELD_DESC);
          oprot.writeI64(struct.id);
          oprot.writeFieldEnd();
          oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
          oprot.writeI64(struct.create_time);
          oprot.writeFieldEnd();
          oprot.writeFieldBegin(MODIFY_TIME_FIELD_DESC);
          oprot.writeI64(struct.modify_time);
          oprot.writeFieldEnd();
          if (struct.username != null) {
            oprot.writeFieldBegin(USERNAME_FIELD_DESC);
            oprot.writeString(struct.username);
            oprot.writeFieldEnd();
          }
          if (struct.password != null) {
            oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
            oprot.writeString(struct.password);
            oprot.writeFieldEnd();
          }
          if (struct.openid != null) {
            oprot.writeFieldBegin(OPENID_FIELD_DESC);
            oprot.writeString(struct.openid);
            oprot.writeFieldEnd();
          }
          if (struct.nickname != null) {
            oprot.writeFieldBegin(NICKNAME_FIELD_DESC);
            oprot.writeString(struct.nickname);
            oprot.writeFieldEnd();
          }
          oprot.writeFieldBegin(SEX_FIELD_DESC);
          oprot.writeI32(struct.sex);
          oprot.writeFieldEnd();
          if (struct.province != null) {
            oprot.writeFieldBegin(PROVINCE_FIELD_DESC);
            oprot.writeString(struct.province);
            oprot.writeFieldEnd();
          }
          if (struct.city != null) {
            oprot.writeFieldBegin(CITY_FIELD_DESC);
            oprot.writeString(struct.city);
            oprot.writeFieldEnd();
          }
          if (struct.country != null) {
            oprot.writeFieldBegin(COUNTRY_FIELD_DESC);
            oprot.writeString(struct.country);
            oprot.writeFieldEnd();
          }
          if (struct.headimgurl != null) {
            oprot.writeFieldBegin(HEADIMGURL_FIELD_DESC);
            oprot.writeString(struct.headimgurl);
            oprot.writeFieldEnd();
          }
          if (struct.unionid != null) {
            oprot.writeFieldBegin(UNIONID_FIELD_DESC);
            oprot.writeString(struct.unionid);
            oprot.writeFieldEnd();
          }
          oprot.writeFieldStop();
          oprot.writeStructEnd();
        }
    
      }
    
      private static class UserTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
        public UserTupleScheme getScheme() {
          return new UserTupleScheme();
        }
      }
    
      private static class UserTupleScheme extends org.apache.thrift.scheme.TupleScheme<User> {
    
        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, User struct) throws org.apache.thrift.TException {
          org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
          java.util.BitSet optionals = new java.util.BitSet();
          if (struct.isSetId()) {
            optionals.set(0);
          }
          if (struct.isSetCreate_time()) {
            optionals.set(1);
          }
          if (struct.isSetModify_time()) {
            optionals.set(2);
          }
          if (struct.isSetUsername()) {
            optionals.set(3);
          }
          if (struct.isSetPassword()) {
            optionals.set(4);
          }
          if (struct.isSetOpenid()) {
            optionals.set(5);
          }
          if (struct.isSetNickname()) {
            optionals.set(6);
          }
          if (struct.isSetSex()) {
            optionals.set(7);
          }
          if (struct.isSetProvince()) {
            optionals.set(8);
          }
          if (struct.isSetCity()) {
            optionals.set(9);
          }
          if (struct.isSetCountry()) {
            optionals.set(10);
          }
          if (struct.isSetHeadimgurl()) {
            optionals.set(11);
          }
          if (struct.isSetUnionid()) {
            optionals.set(12);
          }
          oprot.writeBitSet(optionals, 13);
          if (struct.isSetId()) {
            oprot.writeI64(struct.id);
          }
          if (struct.isSetCreate_time()) {
            oprot.writeI64(struct.create_time);
          }
          if (struct.isSetModify_time()) {
            oprot.writeI64(struct.modify_time);
          }
          if (struct.isSetUsername()) {
            oprot.writeString(struct.username);
          }
          if (struct.isSetPassword()) {
            oprot.writeString(struct.password);
          }
          if (struct.isSetOpenid()) {
            oprot.writeString(struct.openid);
          }
          if (struct.isSetNickname()) {
            oprot.writeString(struct.nickname);
          }
          if (struct.isSetSex()) {
            oprot.writeI32(struct.sex);
          }
          if (struct.isSetProvince()) {
            oprot.writeString(struct.province);
          }
          if (struct.isSetCity()) {
            oprot.writeString(struct.city);
          }
          if (struct.isSetCountry()) {
            oprot.writeString(struct.country);
          }
          if (struct.isSetHeadimgurl()) {
            oprot.writeString(struct.headimgurl);
          }
          if (struct.isSetUnionid()) {
            oprot.writeString(struct.unionid);
          }
        }
    
        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, User struct) throws org.apache.thrift.TException {
          org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
          java.util.BitSet incoming = iprot.readBitSet(13);
          if (incoming.get(0)) {
            struct.id = iprot.readI64();
            struct.setIdIsSet(true);
          }
          if (incoming.get(1)) {
            struct.create_time = iprot.readI64();
            struct.setCreate_timeIsSet(true);
          }
          if (incoming.get(2)) {
            struct.modify_time = iprot.readI64();
            struct.setModify_timeIsSet(true);
          }
          if (incoming.get(3)) {
            struct.username = iprot.readString();
            struct.setUsernameIsSet(true);
          }
          if (incoming.get(4)) {
            struct.password = iprot.readString();
            struct.setPasswordIsSet(true);
          }
          if (incoming.get(5)) {
            struct.openid = iprot.readString();
            struct.setOpenidIsSet(true);
          }
          if (incoming.get(6)) {
            struct.nickname = iprot.readString();
            struct.setNicknameIsSet(true);
          }
          if (incoming.get(7)) {
            struct.sex = iprot.readI32();
            struct.setSexIsSet(true);
          }
          if (incoming.get(8)) {
            struct.province = iprot.readString();
            struct.setProvinceIsSet(true);
          }
          if (incoming.get(9)) {
            struct.city = iprot.readString();
            struct.setCityIsSet(true);
          }
          if (incoming.get(10)) {
            struct.country = iprot.readString();
            struct.setCountryIsSet(true);
          }
          if (incoming.get(11)) {
            struct.headimgurl = iprot.readString();
            struct.setHeadimgurlIsSet(true);
          }
          if (incoming.get(12)) {
            struct.unionid = iprot.readString();
            struct.setUnionidIsSet(true);
          }
        }
      }
    
      private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
        return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
      }
    }
    
    • UserService类

          /**
       * Autogenerated by Thrift Compiler (0.11.0)
       *
       * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
       *  @generated
       */
      
      @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
      @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-04-09")
      public class UserService {
      
        public interface Iface {
      
          public java.lang.String login(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException;
      
          public User registerUser(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException;
      
          public java.lang.String weixinLogin(java.lang.String access_token) throws org.apache.thrift.TException;
      
          public User getUser(java.lang.String token) throws org.apache.thrift.TException;
      
        }
      
        public interface AsyncIface {
      
          public void login(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException;
      
          public void registerUser(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException;
      
          public void weixinLogin(java.lang.String access_token, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException;
      
          public void getUser(java.lang.String token, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException;
      
        }
      
        public static class Client extends org.apache.thrift.TServiceClient implements Iface {
          public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
            public Factory() {}
            public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
              return new Client(prot);
            }
            public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
              return new Client(iprot, oprot);
            }
          }
      
          public Client(org.apache.thrift.protocol.TProtocol prot)
          {
            super(prot, prot);
          }
      
          public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
            super(iprot, oprot);
          }
      
          public java.lang.String login(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException
          {
            send_login(username, password);
            return recv_login();
          }
      
          public void send_login(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException
          {
            login_args args = new login_args();
            args.setUsername(username);
            args.setPassword(password);
            sendBase("login", args);
          }
      
          public java.lang.String recv_login() throws org.apache.thrift.TException
          {
            login_result result = new login_result();
            receiveBase(result, "login");
            if (result.isSetSuccess()) {
              return result.success;
            }
            throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "login failed: unknown result");
          }
      
          public User registerUser(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException
          {
            send_registerUser(username, password);
            return recv_registerUser();
          }
      
          public void send_registerUser(java.lang.String username, java.lang.String password) throws org.apache.thrift.TException
          {
            registerUser_args args = new registerUser_args();
            args.setUsername(username);
            args.setPassword(password);
            sendBase("registerUser", args);
          }
      
          public User recv_registerUser() throws org.apache.thrift.TException
          {
            registerUser_result result = new registerUser_result();
            receiveBase(result, "registerUser");
            if (result.isSetSuccess()) {
              return result.success;
            }
            throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "registerUser failed: unknown result");
          }
      
          public java.lang.String weixinLogin(java.lang.String access_token) throws org.apache.thrift.TException
          {
            send_weixinLogin(access_token);
            return recv_weixinLogin();
          }
      
          public void send_weixinLogin(java.lang.String access_token) throws org.apache.thrift.TException
          {
            weixinLogin_args args = new weixinLogin_args();
            args.setAccess_token(access_token);
            sendBase("weixinLogin", args);
          }
      
          public java.lang.String recv_weixinLogin() throws org.apache.thrift.TException
          {
            weixinLogin_result result = new weixinLogin_result();
            receiveBase(result, "weixinLogin");
            if (result.isSetSuccess()) {
              return result.success;
            }
            throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "weixinLogin failed: unknown result");
          }
      
          public User getUser(java.lang.String token) throws org.apache.thrift.TException
          {
            send_getUser(token);
            return recv_getUser();
          }
      
          public void send_getUser(java.lang.String token) throws org.apache.thrift.TException
          {
            getUser_args args = new getUser_args();
            args.setToken(token);
            sendBase("getUser", args);
          }
      
          public User recv_getUser() throws org.apache.thrift.TException
          {
            getUser_result result = new getUser_result();
            receiveBase(result, "getUser");
            if (result.isSetSuccess()) {
              return result.success;
            }
            throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUser failed: unknown result");
          }
      
        }
        public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
          public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
            private org.apache.thrift.async.TAsyncClientManager clientManager;
            private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
            public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
              this.clientManager = clientManager;
              this.protocolFactory = protocolFactory;
            }
            public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
              return new AsyncClient(protocolFactory, clientManager, transport);
            }
          }
      
          public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
            super(protocolFactory, clientManager, transport);
          }
      
          public void login(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException {
            checkReady();
            login_call method_call = new login_call(username, password, resultHandler, this, ___protocolFactory, ___transport);
            this.___currentMethod = method_call;
            ___manager.call(method_call);
          }
      
          public static class login_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> {
            private java.lang.String username;
            private java.lang.String password;
            public login_call(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
              super(client, protocolFactory, transport, resultHandler, false);
              this.username = username;
              this.password = password;
            }
      
            public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
              prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("login", org.apache.thrift.protocol.TMessageType.CALL, 0));
              login_args args = new login_args();
              args.setUsername(username);
              args.setPassword(password);
              args.write(prot);
              prot.writeMessageEnd();
            }
      
            public java.lang.String getResult() throws org.apache.thrift.TException {
              if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
                throw new java.lang.IllegalStateException("Method call not finished!");
              }
              org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
              org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
              return (new Client(prot)).recv_login();
            }
          }
      
          public void registerUser(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException {
            checkReady();
            registerUser_call method_call = new registerUser_call(username, password, resultHandler, this, ___protocolFactory, ___transport);
            this.___currentMethod = method_call;
            ___manager.call(method_call);
          }
      
          public static class registerUser_call extends org.apache.thrift.async.TAsyncMethodCall<User> {
            private java.lang.String username;
            private java.lang.String password;
            public registerUser_call(java.lang.String username, java.lang.String password, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
              super(client, protocolFactory, transport, resultHandler, false);
              this.username = username;
              this.password = password;
            }
      
            public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
              prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("registerUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
              registerUser_args args = new registerUser_args();
              args.setUsername(username);
              args.setPassword(password);
              args.write(prot);
              prot.writeMessageEnd();
            }
      
            public User getResult() throws org.apache.thrift.TException {
              if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
                throw new java.lang.IllegalStateException("Method call not finished!");
              }
              org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
              org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
              return (new Client(prot)).recv_registerUser();
            }
          }
      
          public void weixinLogin(java.lang.String access_token, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException {
            checkReady();
            weixinLogin_call method_call = new weixinLogin_call(access_token, resultHandler, this, ___protocolFactory, ___transport);
            this.___currentMethod = method_call;
            ___manager.call(method_call);
          }
      
          public static class weixinLogin_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> {
            private java.lang.String access_token;
            public weixinLogin_call(java.lang.String access_token, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
              super(client, protocolFactory, transport, resultHandler, false);
              this.access_token = access_token;
            }
      
            public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
              prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("weixinLogin", org.apache.thrift.protocol.TMessageType.CALL, 0));
              weixinLogin_args args = new weixinLogin_args();
              args.setAccess_token(access_token);
              args.write(prot);
              prot.writeMessageEnd();
            }
      
            public java.lang.String getResult() throws org.apache.thrift.TException {
              if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
                throw new java.lang.IllegalStateException("Method call not finished!");
              }
              org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
              org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
              return (new Client(prot)).recv_weixinLogin();
            }
          }
      
          public void getUser(java.lang.String token, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException {
            checkReady();
            getUser_call method_call = new getUser_call(token, resultHandler, this, ___protocolFactory, ___transport);
            this.___currentMethod = method_call;
            ___manager.call(method_call);
          }
      
          public static class getUser_call extends org.apache.thrift.async.TAsyncMethodCall<User> {
            private java.lang.String token;
            public getUser_call(java.lang.String token, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
              super(client, protocolFactory, transport, resultHandler, false);
              this.token = token;
            }
      
            public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
              prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
              getUser_args args = new getUser_args();
              args.setToken(token);
              args.write(prot);
              prot.writeMessageEnd();
            }
      
            public User getResult() throws org.apache.thrift.TException {
              if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
                throw new java.lang.IllegalStateException("Method call not finished!");
              }
              org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
              org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
              return (new Client(prot)).recv_getUser();
            }
          }
      
        }
      
        public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
          private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
          public Processor(I iface) {
            super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
          }
      
          protected Processor(I iface, java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
            super(iface, getProcessMap(processMap));
          }
      
          private static <I extends Iface> java.util.Map<java.lang.String,  org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
            processMap.put("login", new login());
            processMap.put("registerUser", new registerUser());
            processMap.put("weixinLogin", new weixinLogin());
            processMap.put("getUser", new getUser());
            return processMap;
          }
      
          public static class login<I extends Iface> extends org.apache.thrift.ProcessFunction<I, login_args> {
            public login() {
              super("login");
            }
      
            public login_args getEmptyArgsInstance() {
              return new login_args();
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            @Override
            protected boolean handleRuntimeExceptions() {
              return false;
            }
      
            public login_result getResult(I iface, login_args args) throws org.apache.thrift.TException {
              login_result result = new login_result();
              result.success = iface.login(args.username, args.password);
              return result;
            }
          }
      
          public static class registerUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, registerUser_args> {
            public registerUser() {
              super("registerUser");
            }
      
            public registerUser_args getEmptyArgsInstance() {
              return new registerUser_args();
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            @Override
            protected boolean handleRuntimeExceptions() {
              return false;
            }
      
            public registerUser_result getResult(I iface, registerUser_args args) throws org.apache.thrift.TException {
              registerUser_result result = new registerUser_result();
              result.success = iface.registerUser(args.username, args.password);
              return result;
            }
          }
      
          public static class weixinLogin<I extends Iface> extends org.apache.thrift.ProcessFunction<I, weixinLogin_args> {
            public weixinLogin() {
              super("weixinLogin");
            }
      
            public weixinLogin_args getEmptyArgsInstance() {
              return new weixinLogin_args();
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            @Override
            protected boolean handleRuntimeExceptions() {
              return false;
            }
      
            public weixinLogin_result getResult(I iface, weixinLogin_args args) throws org.apache.thrift.TException {
              weixinLogin_result result = new weixinLogin_result();
              result.success = iface.weixinLogin(args.access_token);
              return result;
            }
          }
      
          public static class getUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUser_args> {
            public getUser() {
              super("getUser");
            }
      
            public getUser_args getEmptyArgsInstance() {
              return new getUser_args();
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            @Override
            protected boolean handleRuntimeExceptions() {
              return false;
            }
      
            public getUser_result getResult(I iface, getUser_args args) throws org.apache.thrift.TException {
              getUser_result result = new getUser_result();
              result.success = iface.getUser(args.token);
              return result;
            }
          }
      
        }
      
        public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
          private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
          public AsyncProcessor(I iface) {
            super(iface, getProcessMap(new java.util.HashMap<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
          }
      
          protected AsyncProcessor(I iface, java.util.Map<java.lang.String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
            super(iface, getProcessMap(processMap));
          }
      
          private static <I extends AsyncIface> java.util.Map<java.lang.String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<java.lang.String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
            processMap.put("login", new login());
            processMap.put("registerUser", new registerUser());
            processMap.put("weixinLogin", new weixinLogin());
            processMap.put("getUser", new getUser());
            return processMap;
          }
      
          public static class login<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, login_args, java.lang.String> {
            public login() {
              super("login");
            }
      
            public login_args getEmptyArgsInstance() {
              return new login_args();
            }
      
            public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
              final org.apache.thrift.AsyncProcessFunction fcall = this;
              return new org.apache.thrift.async.AsyncMethodCallback<java.lang.String>() { 
                public void onComplete(java.lang.String o) {
                  login_result result = new login_result();
                  result.success = o;
                  try {
                    fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
                  } catch (org.apache.thrift.transport.TTransportException e) {
                    _LOGGER.error("TTransportException writing to internal frame buffer", e);
                    fb.close();
                  } catch (java.lang.Exception e) {
                    _LOGGER.error("Exception writing to internal frame buffer", e);
                    onError(e);
                  }
                }
                public void onError(java.lang.Exception e) {
                  byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
                  org.apache.thrift.TSerializable msg;
                  login_result result = new login_result();
                  if (e instanceof org.apache.thrift.transport.TTransportException) {
                    _LOGGER.error("TTransportException inside handler", e);
                    fb.close();
                    return;
                  } else if (e instanceof org.apache.thrift.TApplicationException) {
                    _LOGGER.error("TApplicationException inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = (org.apache.thrift.TApplicationException)e;
                  } else {
                    _LOGGER.error("Exception inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
                  }
                  try {
                    fcall.sendResponse(fb,msg,msgType,seqid);
                  } catch (java.lang.Exception ex) {
                    _LOGGER.error("Exception writing to internal frame buffer", ex);
                    fb.close();
                  }
                }
              };
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            public void start(I iface, login_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException {
              iface.login(args.username, args.password,resultHandler);
            }
          }
      
          public static class registerUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, registerUser_args, User> {
            public registerUser() {
              super("registerUser");
            }
      
            public registerUser_args getEmptyArgsInstance() {
              return new registerUser_args();
            }
      
            public org.apache.thrift.async.AsyncMethodCallback<User> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
              final org.apache.thrift.AsyncProcessFunction fcall = this;
              return new org.apache.thrift.async.AsyncMethodCallback<User>() { 
                public void onComplete(User o) {
                  registerUser_result result = new registerUser_result();
                  result.success = o;
                  try {
                    fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
                  } catch (org.apache.thrift.transport.TTransportException e) {
                    _LOGGER.error("TTransportException writing to internal frame buffer", e);
                    fb.close();
                  } catch (java.lang.Exception e) {
                    _LOGGER.error("Exception writing to internal frame buffer", e);
                    onError(e);
                  }
                }
                public void onError(java.lang.Exception e) {
                  byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
                  org.apache.thrift.TSerializable msg;
                  registerUser_result result = new registerUser_result();
                  if (e instanceof org.apache.thrift.transport.TTransportException) {
                    _LOGGER.error("TTransportException inside handler", e);
                    fb.close();
                    return;
                  } else if (e instanceof org.apache.thrift.TApplicationException) {
                    _LOGGER.error("TApplicationException inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = (org.apache.thrift.TApplicationException)e;
                  } else {
                    _LOGGER.error("Exception inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
                  }
                  try {
                    fcall.sendResponse(fb,msg,msgType,seqid);
                  } catch (java.lang.Exception ex) {
                    _LOGGER.error("Exception writing to internal frame buffer", ex);
                    fb.close();
                  }
                }
              };
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            public void start(I iface, registerUser_args args, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException {
              iface.registerUser(args.username, args.password,resultHandler);
            }
          }
      
          public static class weixinLogin<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, weixinLogin_args, java.lang.String> {
            public weixinLogin() {
              super("weixinLogin");
            }
      
            public weixinLogin_args getEmptyArgsInstance() {
              return new weixinLogin_args();
            }
      
            public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
              final org.apache.thrift.AsyncProcessFunction fcall = this;
              return new org.apache.thrift.async.AsyncMethodCallback<java.lang.String>() { 
                public void onComplete(java.lang.String o) {
                  weixinLogin_result result = new weixinLogin_result();
                  result.success = o;
                  try {
                    fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
                  } catch (org.apache.thrift.transport.TTransportException e) {
                    _LOGGER.error("TTransportException writing to internal frame buffer", e);
                    fb.close();
                  } catch (java.lang.Exception e) {
                    _LOGGER.error("Exception writing to internal frame buffer", e);
                    onError(e);
                  }
                }
                public void onError(java.lang.Exception e) {
                  byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
                  org.apache.thrift.TSerializable msg;
                  weixinLogin_result result = new weixinLogin_result();
                  if (e instanceof org.apache.thrift.transport.TTransportException) {
                    _LOGGER.error("TTransportException inside handler", e);
                    fb.close();
                    return;
                  } else if (e instanceof org.apache.thrift.TApplicationException) {
                    _LOGGER.error("TApplicationException inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = (org.apache.thrift.TApplicationException)e;
                  } else {
                    _LOGGER.error("Exception inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
                  }
                  try {
                    fcall.sendResponse(fb,msg,msgType,seqid);
                  } catch (java.lang.Exception ex) {
                    _LOGGER.error("Exception writing to internal frame buffer", ex);
                    fb.close();
                  }
                }
              };
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            public void start(I iface, weixinLogin_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException {
              iface.weixinLogin(args.access_token,resultHandler);
            }
          }
      
          public static class getUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUser_args, User> {
            public getUser() {
              super("getUser");
            }
      
            public getUser_args getEmptyArgsInstance() {
              return new getUser_args();
            }
      
            public org.apache.thrift.async.AsyncMethodCallback<User> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
              final org.apache.thrift.AsyncProcessFunction fcall = this;
              return new org.apache.thrift.async.AsyncMethodCallback<User>() { 
                public void onComplete(User o) {
                  getUser_result result = new getUser_result();
                  result.success = o;
                  try {
                    fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
                  } catch (org.apache.thrift.transport.TTransportException e) {
                    _LOGGER.error("TTransportException writing to internal frame buffer", e);
                    fb.close();
                  } catch (java.lang.Exception e) {
                    _LOGGER.error("Exception writing to internal frame buffer", e);
                    onError(e);
                  }
                }
                public void onError(java.lang.Exception e) {
                  byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
                  org.apache.thrift.TSerializable msg;
                  getUser_result result = new getUser_result();
                  if (e instanceof org.apache.thrift.transport.TTransportException) {
                    _LOGGER.error("TTransportException inside handler", e);
                    fb.close();
                    return;
                  } else if (e instanceof org.apache.thrift.TApplicationException) {
                    _LOGGER.error("TApplicationException inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = (org.apache.thrift.TApplicationException)e;
                  } else {
                    _LOGGER.error("Exception inside handler", e);
                    msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
                    msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
                  }
                  try {
                    fcall.sendResponse(fb,msg,msgType,seqid);
                  } catch (java.lang.Exception ex) {
                    _LOGGER.error("Exception writing to internal frame buffer", ex);
                    fb.close();
                  }
                }
              };
            }
      
            protected boolean isOneway() {
              return false;
            }
      
            public void start(I iface, getUser_args args, org.apache.thrift.async.AsyncMethodCallback<User> resultHandler) throws org.apache.thrift.TException {
              iface.getUser(args.token,resultHandler);
            }
          }
      
        }
      
        public static class login_args implements org.apache.thrift.TBase<login_args, login_args._Fields>, java.io.Serializable, Cloneable, Comparable<login_args>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("login_args");
      
          private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
          private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new login_argsStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new login_argsTupleSchemeFactory();
      
          public java.lang.String username; // required
          public java.lang.String password; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            USERNAME((short)1, "username"),
            PASSWORD((short)2, "password");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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: // USERNAME
                  return USERNAME;
                case 2: // PASSWORD
                  return PASSWORD;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(login_args.class, metaDataMap);
          }
      
          public login_args() {
          }
      
          public login_args(
            java.lang.String username,
            java.lang.String password)
          {
            this();
            this.username = username;
            this.password = password;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public login_args(login_args other) {
            if (other.isSetUsername()) {
              this.username = other.username;
            }
            if (other.isSetPassword()) {
              this.password = other.password;
            }
          }
      
          public login_args deepCopy() {
            return new login_args(this);
          }
      
          @Override
          public void clear() {
            this.username = null;
            this.password = null;
          }
      
          public java.lang.String getUsername() {
            return this.username;
          }
      
          public login_args setUsername(java.lang.String username) {
            this.username = username;
            return this;
          }
      
          public void unsetUsername() {
            this.username = null;
          }
      
          /** Returns true if field username is set (has been assigned a value) and false otherwise */
          public boolean isSetUsername() {
            return this.username != null;
          }
      
          public void setUsernameIsSet(boolean value) {
            if (!value) {
              this.username = null;
            }
          }
      
          public java.lang.String getPassword() {
            return this.password;
          }
      
          public login_args setPassword(java.lang.String password) {
            this.password = password;
            return this;
          }
      
          public void unsetPassword() {
            this.password = null;
          }
      
          /** Returns true if field password is set (has been assigned a value) and false otherwise */
          public boolean isSetPassword() {
            return this.password != null;
          }
      
          public void setPasswordIsSet(boolean value) {
            if (!value) {
              this.password = null;
            }
          }
      
          public void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case USERNAME:
              if (value == null) {
                unsetUsername();
              } else {
                setUsername((java.lang.String)value);
              }
              break;
      
            case PASSWORD:
              if (value == null) {
                unsetPassword();
              } else {
                setPassword((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case USERNAME:
              return getUsername();
      
            case PASSWORD:
              return getPassword();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case USERNAME:
              return isSetUsername();
            case PASSWORD:
              return isSetPassword();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof login_args)
              return this.equals((login_args)that);
            return false;
          }
      
          public boolean equals(login_args that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            boolean this_present_username = true && this.isSetUsername();
            boolean that_present_username = true && that.isSetUsername();
            if (this_present_username || that_present_username) {
              if (!(this_present_username && that_present_username))
                return false;
              if (!this.username.equals(that.username))
                return false;
            }
      
            boolean this_present_password = true && this.isSetPassword();
            boolean that_present_password = true && that.isSetPassword();
            if (this_present_password || that_present_password) {
              if (!(this_present_password && that_present_password))
                return false;
              if (!this.password.equals(that.password))
                return false;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
            if (isSetUsername())
              hashCode = hashCode * 8191 + username.hashCode();
      
            hashCode = hashCode * 8191 + ((isSetPassword()) ? 131071 : 524287);
            if (isSetPassword())
              hashCode = hashCode * 8191 + password.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(login_args other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetUsername()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            lastComparison = java.lang.Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetPassword()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
          }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("login_args(");
            boolean first = true;
      
            sb.append("username:");
            if (this.username == null) {
              sb.append("null");
            } else {
              sb.append(this.username);
            }
            first = false;
            if (!first) sb.append(", ");
            sb.append("password:");
            if (this.password == null) {
              sb.append("null");
            } else {
              sb.append(this.password);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class login_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public login_argsStandardScheme getScheme() {
              return new login_argsStandardScheme();
            }
          }
      
          private static class login_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<login_args> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, login_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 1: // USERNAME
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.username = iprot.readString();
                      struct.setUsernameIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  case 2: // PASSWORD
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.password = iprot.readString();
                      struct.setPasswordIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, login_args struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.username != null) {
                oprot.writeFieldBegin(USERNAME_FIELD_DESC);
                oprot.writeString(struct.username);
                oprot.writeFieldEnd();
              }
              if (struct.password != null) {
                oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
                oprot.writeString(struct.password);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class login_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public login_argsTupleScheme getScheme() {
              return new login_argsTupleScheme();
            }
          }
      
          private static class login_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<login_args> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, login_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetUsername()) {
                optionals.set(0);
              }
              if (struct.isSetPassword()) {
                optionals.set(1);
              }
              oprot.writeBitSet(optionals, 2);
              if (struct.isSetUsername()) {
                oprot.writeString(struct.username);
              }
              if (struct.isSetPassword()) {
                oprot.writeString(struct.password);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, login_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(2);
              if (incoming.get(0)) {
                struct.username = iprot.readString();
                struct.setUsernameIsSet(true);
              }
              if (incoming.get(1)) {
                struct.password = iprot.readString();
                struct.setPasswordIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class login_result implements org.apache.thrift.TBase<login_result, login_result._Fields>, java.io.Serializable, Cloneable, Comparable<login_result>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("login_result");
      
          private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new login_resultStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new login_resultTupleSchemeFactory();
      
          public java.lang.String success; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            SUCCESS((short)0, "success");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(login_result.class, metaDataMap);
          }
      
          public login_result() {
          }
      
          public login_result(
            java.lang.String success)
          {
            this();
            this.success = success;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public login_result(login_result other) {
            if (other.isSetSuccess()) {
              this.success = other.success;
            }
          }
      
          public login_result deepCopy() {
            return new login_result(this);
          }
      
          @Override
          public void clear() {
            this.success = null;
          }
      
          public java.lang.String getSuccess() {
            return this.success;
          }
      
          public login_result setSuccess(java.lang.String 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 void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case SUCCESS:
              if (value == null) {
                unsetSuccess();
              } else {
                setSuccess((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case SUCCESS:
              return getSuccess();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case SUCCESS:
              return isSetSuccess();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof login_result)
              return this.equals((login_result)that);
            return false;
          }
      
          public boolean equals(login_result that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            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;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
            if (isSetSuccess())
              hashCode = hashCode * 8191 + success.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(login_result other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetSuccess()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
            }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("login_result(");
            boolean first = true;
      
            sb.append("success:");
            if (this.success == null) {
              sb.append("null");
            } else {
              sb.append(this.success);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class login_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public login_resultStandardScheme getScheme() {
              return new login_resultStandardScheme();
            }
          }
      
          private static class login_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<login_result> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, login_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 0: // SUCCESS
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.success = iprot.readString();
                      struct.setSuccessIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, login_result struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.success != null) {
                oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
                oprot.writeString(struct.success);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class login_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public login_resultTupleScheme getScheme() {
              return new login_resultTupleScheme();
            }
          }
      
          private static class login_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<login_result> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, login_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetSuccess()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetSuccess()) {
                oprot.writeString(struct.success);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, login_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.success = iprot.readString();
                struct.setSuccessIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class registerUser_args implements org.apache.thrift.TBase<registerUser_args, registerUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<registerUser_args>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerUser_args");
      
          private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
          private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new registerUser_argsStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new registerUser_argsTupleSchemeFactory();
      
          public java.lang.String username; // required
          public java.lang.String password; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            USERNAME((short)1, "username"),
            PASSWORD((short)2, "password");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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: // USERNAME
                  return USERNAME;
                case 2: // PASSWORD
                  return PASSWORD;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerUser_args.class, metaDataMap);
          }
      
          public registerUser_args() {
          }
      
          public registerUser_args(
            java.lang.String username,
            java.lang.String password)
          {
            this();
            this.username = username;
            this.password = password;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public registerUser_args(registerUser_args other) {
            if (other.isSetUsername()) {
              this.username = other.username;
            }
            if (other.isSetPassword()) {
              this.password = other.password;
            }
          }
      
          public registerUser_args deepCopy() {
            return new registerUser_args(this);
          }
      
          @Override
          public void clear() {
            this.username = null;
            this.password = null;
          }
      
          public java.lang.String getUsername() {
            return this.username;
          }
      
          public registerUser_args setUsername(java.lang.String username) {
            this.username = username;
            return this;
          }
      
          public void unsetUsername() {
            this.username = null;
          }
      
          /** Returns true if field username is set (has been assigned a value) and false otherwise */
          public boolean isSetUsername() {
            return this.username != null;
          }
      
          public void setUsernameIsSet(boolean value) {
            if (!value) {
              this.username = null;
            }
          }
      
          public java.lang.String getPassword() {
            return this.password;
          }
      
          public registerUser_args setPassword(java.lang.String password) {
            this.password = password;
            return this;
          }
      
          public void unsetPassword() {
            this.password = null;
          }
      
          /** Returns true if field password is set (has been assigned a value) and false otherwise */
          public boolean isSetPassword() {
            return this.password != null;
          }
      
          public void setPasswordIsSet(boolean value) {
            if (!value) {
              this.password = null;
            }
          }
      
          public void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case USERNAME:
              if (value == null) {
                unsetUsername();
              } else {
                setUsername((java.lang.String)value);
              }
              break;
      
            case PASSWORD:
              if (value == null) {
                unsetPassword();
              } else {
                setPassword((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case USERNAME:
              return getUsername();
      
            case PASSWORD:
              return getPassword();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case USERNAME:
              return isSetUsername();
            case PASSWORD:
              return isSetPassword();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof registerUser_args)
              return this.equals((registerUser_args)that);
            return false;
          }
      
          public boolean equals(registerUser_args that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            boolean this_present_username = true && this.isSetUsername();
            boolean that_present_username = true && that.isSetUsername();
            if (this_present_username || that_present_username) {
              if (!(this_present_username && that_present_username))
                return false;
              if (!this.username.equals(that.username))
                return false;
            }
      
            boolean this_present_password = true && this.isSetPassword();
            boolean that_present_password = true && that.isSetPassword();
            if (this_present_password || that_present_password) {
              if (!(this_present_password && that_present_password))
                return false;
              if (!this.password.equals(that.password))
                return false;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
            if (isSetUsername())
              hashCode = hashCode * 8191 + username.hashCode();
      
            hashCode = hashCode * 8191 + ((isSetPassword()) ? 131071 : 524287);
            if (isSetPassword())
              hashCode = hashCode * 8191 + password.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(registerUser_args other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetUsername()).compareTo(other.isSetUsername());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetUsername()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            lastComparison = java.lang.Boolean.valueOf(isSetPassword()).compareTo(other.isSetPassword());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetPassword()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
          }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("registerUser_args(");
            boolean first = true;
      
            sb.append("username:");
            if (this.username == null) {
              sb.append("null");
            } else {
              sb.append(this.username);
            }
            first = false;
            if (!first) sb.append(", ");
            sb.append("password:");
            if (this.password == null) {
              sb.append("null");
            } else {
              sb.append(this.password);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class registerUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public registerUser_argsStandardScheme getScheme() {
              return new registerUser_argsStandardScheme();
            }
          }
      
          private static class registerUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<registerUser_args> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, registerUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 1: // USERNAME
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.username = iprot.readString();
                      struct.setUsernameIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  case 2: // PASSWORD
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.password = iprot.readString();
                      struct.setPasswordIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, registerUser_args struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.username != null) {
                oprot.writeFieldBegin(USERNAME_FIELD_DESC);
                oprot.writeString(struct.username);
                oprot.writeFieldEnd();
              }
              if (struct.password != null) {
                oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
                oprot.writeString(struct.password);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class registerUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public registerUser_argsTupleScheme getScheme() {
              return new registerUser_argsTupleScheme();
            }
          }
      
          private static class registerUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<registerUser_args> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, registerUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetUsername()) {
                optionals.set(0);
              }
              if (struct.isSetPassword()) {
                optionals.set(1);
              }
              oprot.writeBitSet(optionals, 2);
              if (struct.isSetUsername()) {
                oprot.writeString(struct.username);
              }
              if (struct.isSetPassword()) {
                oprot.writeString(struct.password);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, registerUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(2);
              if (incoming.get(0)) {
                struct.username = iprot.readString();
                struct.setUsernameIsSet(true);
              }
              if (incoming.get(1)) {
                struct.password = iprot.readString();
                struct.setPasswordIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class registerUser_result implements org.apache.thrift.TBase<registerUser_result, registerUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<registerUser_result>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("registerUser_result");
      
          private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new registerUser_resultStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new registerUser_resultTupleSchemeFactory();
      
          public User success; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            SUCCESS((short)0, "success");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, User.class)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(registerUser_result.class, metaDataMap);
          }
      
          public registerUser_result() {
          }
      
          public registerUser_result(
            User success)
          {
            this();
            this.success = success;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public registerUser_result(registerUser_result other) {
            if (other.isSetSuccess()) {
              this.success = new User(other.success);
            }
          }
      
          public registerUser_result deepCopy() {
            return new registerUser_result(this);
          }
      
          @Override
          public void clear() {
            this.success = null;
          }
      
          public User getSuccess() {
            return this.success;
          }
      
          public registerUser_result setSuccess(User 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 void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case SUCCESS:
              if (value == null) {
                unsetSuccess();
              } else {
                setSuccess((User)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case SUCCESS:
              return getSuccess();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case SUCCESS:
              return isSetSuccess();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof registerUser_result)
              return this.equals((registerUser_result)that);
            return false;
          }
      
          public boolean equals(registerUser_result that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            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;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
            if (isSetSuccess())
              hashCode = hashCode * 8191 + success.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(registerUser_result other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetSuccess()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
            }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("registerUser_result(");
            boolean first = true;
      
            sb.append("success:");
            if (this.success == null) {
              sb.append("null");
            } else {
              sb.append(this.success);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.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 org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class registerUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public registerUser_resultStandardScheme getScheme() {
              return new registerUser_resultStandardScheme();
            }
          }
      
          private static class registerUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<registerUser_result> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, registerUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 0: // SUCCESS
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                      struct.success = new User();
                      struct.success.read(iprot);
                      struct.setSuccessIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, registerUser_result struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.success != null) {
                oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
                struct.success.write(oprot);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class registerUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public registerUser_resultTupleScheme getScheme() {
              return new registerUser_resultTupleScheme();
            }
          }
      
          private static class registerUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<registerUser_result> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, registerUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetSuccess()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetSuccess()) {
                struct.success.write(oprot);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, registerUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.success = new User();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class weixinLogin_args implements org.apache.thrift.TBase<weixinLogin_args, weixinLogin_args._Fields>, java.io.Serializable, Cloneable, Comparable<weixinLogin_args>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("weixinLogin_args");
      
          private static final org.apache.thrift.protocol.TField ACCESS_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("access_token", org.apache.thrift.protocol.TType.STRING, (short)1);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new weixinLogin_argsStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new weixinLogin_argsTupleSchemeFactory();
      
          public java.lang.String access_token; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            ACCESS_TOKEN((short)1, "access_token");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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: // ACCESS_TOKEN
                  return ACCESS_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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.ACCESS_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("access_token", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(weixinLogin_args.class, metaDataMap);
          }
      
          public weixinLogin_args() {
          }
      
          public weixinLogin_args(
            java.lang.String access_token)
          {
            this();
            this.access_token = access_token;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public weixinLogin_args(weixinLogin_args other) {
            if (other.isSetAccess_token()) {
              this.access_token = other.access_token;
            }
          }
      
          public weixinLogin_args deepCopy() {
            return new weixinLogin_args(this);
          }
      
          @Override
          public void clear() {
            this.access_token = null;
          }
      
          public java.lang.String getAccess_token() {
            return this.access_token;
          }
      
          public weixinLogin_args setAccess_token(java.lang.String access_token) {
            this.access_token = access_token;
            return this;
          }
      
          public void unsetAccess_token() {
            this.access_token = null;
          }
      
          /** Returns true if field access_token is set (has been assigned a value) and false otherwise */
          public boolean isSetAccess_token() {
            return this.access_token != null;
          }
      
          public void setAccess_tokenIsSet(boolean value) {
            if (!value) {
              this.access_token = null;
            }
          }
      
          public void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case ACCESS_TOKEN:
              if (value == null) {
                unsetAccess_token();
              } else {
                setAccess_token((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case ACCESS_TOKEN:
              return getAccess_token();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case ACCESS_TOKEN:
              return isSetAccess_token();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof weixinLogin_args)
              return this.equals((weixinLogin_args)that);
            return false;
          }
      
          public boolean equals(weixinLogin_args that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            boolean this_present_access_token = true && this.isSetAccess_token();
            boolean that_present_access_token = true && that.isSetAccess_token();
            if (this_present_access_token || that_present_access_token) {
              if (!(this_present_access_token && that_present_access_token))
                return false;
              if (!this.access_token.equals(that.access_token))
                return false;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetAccess_token()) ? 131071 : 524287);
            if (isSetAccess_token())
              hashCode = hashCode * 8191 + access_token.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(weixinLogin_args other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetAccess_token()).compareTo(other.isSetAccess_token());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetAccess_token()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.access_token, other.access_token);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
          }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("weixinLogin_args(");
            boolean first = true;
      
            sb.append("access_token:");
            if (this.access_token == null) {
              sb.append("null");
            } else {
              sb.append(this.access_token);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class weixinLogin_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public weixinLogin_argsStandardScheme getScheme() {
              return new weixinLogin_argsStandardScheme();
            }
          }
      
          private static class weixinLogin_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<weixinLogin_args> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, weixinLogin_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 1: // ACCESS_TOKEN
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.access_token = iprot.readString();
                      struct.setAccess_tokenIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, weixinLogin_args struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.access_token != null) {
                oprot.writeFieldBegin(ACCESS_TOKEN_FIELD_DESC);
                oprot.writeString(struct.access_token);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class weixinLogin_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public weixinLogin_argsTupleScheme getScheme() {
              return new weixinLogin_argsTupleScheme();
            }
          }
      
          private static class weixinLogin_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<weixinLogin_args> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, weixinLogin_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetAccess_token()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetAccess_token()) {
                oprot.writeString(struct.access_token);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, weixinLogin_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.access_token = iprot.readString();
                struct.setAccess_tokenIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class weixinLogin_result implements org.apache.thrift.TBase<weixinLogin_result, weixinLogin_result._Fields>, java.io.Serializable, Cloneable, Comparable<weixinLogin_result>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("weixinLogin_result");
      
          private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new weixinLogin_resultStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new weixinLogin_resultTupleSchemeFactory();
      
          public java.lang.String success; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            SUCCESS((short)0, "success");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(weixinLogin_result.class, metaDataMap);
          }
      
          public weixinLogin_result() {
          }
      
          public weixinLogin_result(
            java.lang.String success)
          {
            this();
            this.success = success;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public weixinLogin_result(weixinLogin_result other) {
            if (other.isSetSuccess()) {
              this.success = other.success;
            }
          }
      
          public weixinLogin_result deepCopy() {
            return new weixinLogin_result(this);
          }
      
          @Override
          public void clear() {
            this.success = null;
          }
      
          public java.lang.String getSuccess() {
            return this.success;
          }
      
          public weixinLogin_result setSuccess(java.lang.String 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 void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case SUCCESS:
              if (value == null) {
                unsetSuccess();
              } else {
                setSuccess((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case SUCCESS:
              return getSuccess();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case SUCCESS:
              return isSetSuccess();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof weixinLogin_result)
              return this.equals((weixinLogin_result)that);
            return false;
          }
      
          public boolean equals(weixinLogin_result that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            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;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
            if (isSetSuccess())
              hashCode = hashCode * 8191 + success.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(weixinLogin_result other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetSuccess()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
            }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("weixinLogin_result(");
            boolean first = true;
      
            sb.append("success:");
            if (this.success == null) {
              sb.append("null");
            } else {
              sb.append(this.success);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class weixinLogin_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public weixinLogin_resultStandardScheme getScheme() {
              return new weixinLogin_resultStandardScheme();
            }
          }
      
          private static class weixinLogin_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<weixinLogin_result> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, weixinLogin_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 0: // SUCCESS
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.success = iprot.readString();
                      struct.setSuccessIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, weixinLogin_result struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.success != null) {
                oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
                oprot.writeString(struct.success);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class weixinLogin_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public weixinLogin_resultTupleScheme getScheme() {
              return new weixinLogin_resultTupleScheme();
            }
          }
      
          private static class weixinLogin_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<weixinLogin_result> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, weixinLogin_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetSuccess()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetSuccess()) {
                oprot.writeString(struct.success);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, weixinLogin_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.success = iprot.readString();
                struct.setSuccessIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class getUser_args implements org.apache.thrift.TBase<getUser_args, getUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUser_args>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUser_args");
      
          private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("token", org.apache.thrift.protocol.TType.STRING, (short)1);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUser_argsStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUser_argsTupleSchemeFactory();
      
          public java.lang.String token; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            TOKEN((short)1, "token");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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: // TOKEN
                  return 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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.TOKEN, new org.apache.thrift.meta_data.FieldMetaData("token", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUser_args.class, metaDataMap);
          }
      
          public getUser_args() {
          }
      
          public getUser_args(
            java.lang.String token)
          {
            this();
            this.token = token;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public getUser_args(getUser_args other) {
            if (other.isSetToken()) {
              this.token = other.token;
            }
          }
      
          public getUser_args deepCopy() {
            return new getUser_args(this);
          }
      
          @Override
          public void clear() {
            this.token = null;
          }
      
          public java.lang.String getToken() {
            return this.token;
          }
      
          public getUser_args setToken(java.lang.String token) {
            this.token = token;
            return this;
          }
      
          public void unsetToken() {
            this.token = null;
          }
      
          /** Returns true if field token is set (has been assigned a value) and false otherwise */
          public boolean isSetToken() {
            return this.token != null;
          }
      
          public void setTokenIsSet(boolean value) {
            if (!value) {
              this.token = null;
            }
          }
      
          public void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case TOKEN:
              if (value == null) {
                unsetToken();
              } else {
                setToken((java.lang.String)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case TOKEN:
              return getToken();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case TOKEN:
              return isSetToken();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof getUser_args)
              return this.equals((getUser_args)that);
            return false;
          }
      
          public boolean equals(getUser_args that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            boolean this_present_token = true && this.isSetToken();
            boolean that_present_token = true && that.isSetToken();
            if (this_present_token || that_present_token) {
              if (!(this_present_token && that_present_token))
                return false;
              if (!this.token.equals(that.token))
                return false;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetToken()) ? 131071 : 524287);
            if (isSetToken())
              hashCode = hashCode * 8191 + token.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(getUser_args other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetToken()).compareTo(other.isSetToken());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetToken()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.token, other.token);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
          }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("getUser_args(");
            boolean first = true;
      
            sb.append("token:");
            if (this.token == null) {
              sb.append("null");
            } else {
              sb.append(this.token);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.TException {
            // check for required fields
            // check for sub-struct validity
          }
      
          private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
            try {
              write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class getUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public getUser_argsStandardScheme getScheme() {
              return new getUser_argsStandardScheme();
            }
          }
      
          private static class getUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUser_args> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, getUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 1: // TOKEN
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                      struct.token = iprot.readString();
                      struct.setTokenIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, getUser_args struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.token != null) {
                oprot.writeFieldBegin(TOKEN_FIELD_DESC);
                oprot.writeString(struct.token);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class getUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public getUser_argsTupleScheme getScheme() {
              return new getUser_argsTupleScheme();
            }
          }
      
          private static class getUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUser_args> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, getUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetToken()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetToken()) {
                oprot.writeString(struct.token);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, getUser_args struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.token = iprot.readString();
                struct.setTokenIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
        public static class getUser_result implements org.apache.thrift.TBase<getUser_result, getUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUser_result>   {
          private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUser_result");
      
          private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
      
          private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUser_resultStandardSchemeFactory();
          private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUser_resultTupleSchemeFactory();
      
          public User success; // required
      
          /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
          public enum _Fields implements org.apache.thrift.TFieldIdEnum {
            SUCCESS((short)0, "success");
      
            private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
      
            static {
              for (_Fields field : java.util.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;
                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 java.lang.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(java.lang.String name) {
              return byName.get(name);
            }
      
            private final short _thriftId;
            private final java.lang.String _fieldName;
      
            _Fields(short thriftId, java.lang.String fieldName) {
              _thriftId = thriftId;
              _fieldName = fieldName;
            }
      
            public short getThriftFieldId() {
              return _thriftId;
            }
      
            public java.lang.String getFieldName() {
              return _fieldName;
            }
          }
      
          // isset id assignments
          public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
          static {
            java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
            tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
                new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, User.class)));
            metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
            org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUser_result.class, metaDataMap);
          }
      
          public getUser_result() {
          }
      
          public getUser_result(
            User success)
          {
            this();
            this.success = success;
          }
      
          /**
           * Performs a deep copy on <i>other</i>.
           */
          public getUser_result(getUser_result other) {
            if (other.isSetSuccess()) {
              this.success = new User(other.success);
            }
          }
      
          public getUser_result deepCopy() {
            return new getUser_result(this);
          }
      
          @Override
          public void clear() {
            this.success = null;
          }
      
          public User getSuccess() {
            return this.success;
          }
      
          public getUser_result setSuccess(User 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 void setFieldValue(_Fields field, java.lang.Object value) {
            switch (field) {
            case SUCCESS:
              if (value == null) {
                unsetSuccess();
              } else {
                setSuccess((User)value);
              }
              break;
      
            }
          }
      
          public java.lang.Object getFieldValue(_Fields field) {
            switch (field) {
            case SUCCESS:
              return getSuccess();
      
            }
            throw new java.lang.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 java.lang.IllegalArgumentException();
            }
      
            switch (field) {
            case SUCCESS:
              return isSetSuccess();
            }
            throw new java.lang.IllegalStateException();
          }
      
          @Override
          public boolean equals(java.lang.Object that) {
            if (that == null)
              return false;
            if (that instanceof getUser_result)
              return this.equals((getUser_result)that);
            return false;
          }
      
          public boolean equals(getUser_result that) {
            if (that == null)
              return false;
            if (this == that)
              return true;
      
            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;
            }
      
            return true;
          }
      
          @Override
          public int hashCode() {
            int hashCode = 1;
      
            hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
            if (isSetSuccess())
              hashCode = hashCode * 8191 + success.hashCode();
      
            return hashCode;
          }
      
          @Override
          public int compareTo(getUser_result other) {
            if (!getClass().equals(other.getClass())) {
              return getClass().getName().compareTo(other.getClass().getName());
            }
      
            int lastComparison = 0;
      
            lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
            if (lastComparison != 0) {
              return lastComparison;
            }
            if (isSetSuccess()) {
              lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
              if (lastComparison != 0) {
                return lastComparison;
              }
            }
            return 0;
          }
      
          public _Fields fieldForId(int fieldId) {
            return _Fields.findByThriftId(fieldId);
          }
      
          public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
            scheme(iprot).read(iprot, this);
          }
      
          public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
            scheme(oprot).write(oprot, this);
            }
      
          @Override
          public java.lang.String toString() {
            java.lang.StringBuilder sb = new java.lang.StringBuilder("getUser_result(");
            boolean first = true;
      
            sb.append("success:");
            if (this.success == null) {
              sb.append("null");
            } else {
              sb.append(this.success);
            }
            first = false;
            sb.append(")");
            return sb.toString();
          }
      
          public void validate() throws org.apache.thrift.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 org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
            try {
              read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
            } catch (org.apache.thrift.TException te) {
              throw new java.io.IOException(te);
            }
          }
      
          private static class getUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public getUser_resultStandardScheme getScheme() {
              return new getUser_resultStandardScheme();
            }
          }
      
          private static class getUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUser_result> {
      
            public void read(org.apache.thrift.protocol.TProtocol iprot, getUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TField schemeField;
              iprot.readStructBegin();
              while (true)
              {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
                  break;
                }
                switch (schemeField.id) {
                  case 0: // SUCCESS
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                      struct.success = new User();
                      struct.success.read(iprot);
                      struct.setSuccessIsSet(true);
                    } else { 
                      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                  default:
                    org.apache.thrift.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(org.apache.thrift.protocol.TProtocol oprot, getUser_result struct) throws org.apache.thrift.TException {
              struct.validate();
      
              oprot.writeStructBegin(STRUCT_DESC);
              if (struct.success != null) {
                oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
                struct.success.write(oprot);
                oprot.writeFieldEnd();
              }
              oprot.writeFieldStop();
              oprot.writeStructEnd();
            }
      
          }
      
          private static class getUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
            public getUser_resultTupleScheme getScheme() {
              return new getUser_resultTupleScheme();
            }
          }
      
          private static class getUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUser_result> {
      
            @Override
            public void write(org.apache.thrift.protocol.TProtocol prot, getUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet optionals = new java.util.BitSet();
              if (struct.isSetSuccess()) {
                optionals.set(0);
              }
              oprot.writeBitSet(optionals, 1);
              if (struct.isSetSuccess()) {
                struct.success.write(oprot);
              }
            }
      
            @Override
            public void read(org.apache.thrift.protocol.TProtocol prot, getUser_result struct) throws org.apache.thrift.TException {
              org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
              java.util.BitSet incoming = iprot.readBitSet(1);
              if (incoming.get(0)) {
                struct.success = new User();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              }
            }
          }
      
          private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
            return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
          }
        }
      
      }
      
  3. 编写服务端代码(写实现类和主方法)

    • 实现类(这个不全--实现接口,把功能补全即可)

    public class UserServiceImpl implements UserService.Iface {
    
        @Override
        public String login(String username, String password) throws TException {
            return null;
        }
    
        @Override
        public User registerUser(String username, String password) throws TException {
            return null;
        }
    
        @Override
        public String weixinLogin(String access_token) throws TException {
            return null;
        }
    
        @Override
        public User getUser(String token) throws TException {
            return null;
        }
    
    }
    
    • 主类

    public class Main {
        public static void main(String[] args) {
            try {
                System.out.println("【User】服务端开启....");
                TProcessor tprocessor = new UserService.Processor<UserService.Iface>(new UserServiceImpl());
                TServerSocket serverTransport = new TServerSocket(6664);
                TServer.Args tArgs = new TServer.Args(serverTransport);
                tArgs.processor(tprocessor);
                tArgs.protocolFactory(new TBinaryProtocol.Factory());
                TServer server = new TSimpleServer(tArgs);
                server.serve();
            } catch (TTransportException e) {
                e.printStackTrace();
            }
        }
    }
    
  4. 编写客户端代码

    public class Main {
        public static void main(String[] args) {
            System.out.println("【User】客户端启动....");
            TTransport transport = null;
            try {
                transport = new TSocket("localhost", 6664, 30000);
                TProtocol protocol = new TBinaryProtocol(transport);
                UserService.Client client = new UserService.Client(protocol);
                transport.open();
                // 测试
                System.out.println("============" + client.方法() + "============");
            } catch (TTransportException e) {
                e.printStackTrace();
            } catch (TException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (null != transport) {
                    transport.close();
                }
            }
        }
    }
    
  5. 测试运行(这个你肯定执行不了,主要是thrift的思路)

    1. 服务端

      服务已开启。。。
      
    2. 客户端

      请求到。。。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乘风御浪云帆之上

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值