Created
November 30, 2012 16:29
-
-
Save glennpratt/4176810 to your computer and use it in GitHub Desktop.
allplayers.thrift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| import java.util.Map; | |
| import java.util.HashMap; | |
| import org.apache.thrift.TEnum; | |
| public enum SexType implements org.apache.thrift.TEnum { | |
| MALE(1), | |
| FEMALE(2); | |
| private final int value; | |
| private SexType(int value) { | |
| this.value = value; | |
| } | |
| /** | |
| * Get the integer value of this enum value, as defined in the Thrift IDL. | |
| */ | |
| public int getValue() { | |
| return value; | |
| } | |
| /** | |
| * Find a the enum type by its integer value, as defined in the Thrift IDL. | |
| * @return null if the value is not found. | |
| */ | |
| public static SexType findByValue(int value) { | |
| switch (value) { | |
| case 1: | |
| return MALE; | |
| case 2: | |
| return FEMALE; | |
| default: | |
| return null; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace ; | |
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| use Thrift\Base\TBase; | |
| use Thrift\Type\TType; | |
| use Thrift\Type\TMessageType; | |
| use Thrift\Exception\TException; | |
| use Thrift\Exception\TProtocolException; | |
| use Thrift\Protocol\TProtocol; | |
| use Thrift\Exception\TApplicationException; | |
| final class SexType { | |
| const MALE = 1; | |
| const FEMALE = 2; | |
| static public $__names = array( | |
| 1 => 'MALE', | |
| 2 => 'FEMALE', | |
| ); | |
| } | |
| class User { | |
| static $_TSPEC; | |
| public $firstname = null; | |
| public $lastname = null; | |
| public $user_id = 0; | |
| public $sex = null; | |
| public $active = false; | |
| public $description = null; | |
| public function __construct($vals=null) { | |
| if (!isset(self::$_TSPEC)) { | |
| self::$_TSPEC = array( | |
| 1 => array( | |
| 'var' => 'firstname', | |
| 'type' => TType::STRING, | |
| ), | |
| 2 => array( | |
| 'var' => 'lastname', | |
| 'type' => TType::STRING, | |
| ), | |
| 3 => array( | |
| 'var' => 'user_id', | |
| 'type' => TType::I32, | |
| ), | |
| 4 => array( | |
| 'var' => 'sex', | |
| 'type' => TType::I32, | |
| ), | |
| 5 => array( | |
| 'var' => 'active', | |
| 'type' => TType::BOOL, | |
| ), | |
| 6 => array( | |
| 'var' => 'description', | |
| 'type' => TType::STRING, | |
| ), | |
| ); | |
| } | |
| if (is_array($vals)) { | |
| if (isset($vals['firstname'])) { | |
| $this->firstname = $vals['firstname']; | |
| } | |
| if (isset($vals['lastname'])) { | |
| $this->lastname = $vals['lastname']; | |
| } | |
| if (isset($vals['user_id'])) { | |
| $this->user_id = $vals['user_id']; | |
| } | |
| if (isset($vals['sex'])) { | |
| $this->sex = $vals['sex']; | |
| } | |
| if (isset($vals['active'])) { | |
| $this->active = $vals['active']; | |
| } | |
| if (isset($vals['description'])) { | |
| $this->description = $vals['description']; | |
| } | |
| } | |
| } | |
| public function getName() { | |
| return 'User'; | |
| } | |
| public function read($input) | |
| { | |
| $xfer = 0; | |
| $fname = null; | |
| $ftype = 0; | |
| $fid = 0; | |
| $xfer += $input->readStructBegin($fname); | |
| while (true) | |
| { | |
| $xfer += $input->readFieldBegin($fname, $ftype, $fid); | |
| if ($ftype == TType::STOP) { | |
| break; | |
| } | |
| switch ($fid) | |
| { | |
| case 1: | |
| if ($ftype == TType::STRING) { | |
| $xfer += $input->readString($this->firstname); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| case 2: | |
| if ($ftype == TType::STRING) { | |
| $xfer += $input->readString($this->lastname); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| case 3: | |
| if ($ftype == TType::I32) { | |
| $xfer += $input->readI32($this->user_id); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| case 4: | |
| if ($ftype == TType::I32) { | |
| $xfer += $input->readI32($this->sex); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| case 5: | |
| if ($ftype == TType::BOOL) { | |
| $xfer += $input->readBool($this->active); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| case 6: | |
| if ($ftype == TType::STRING) { | |
| $xfer += $input->readString($this->description); | |
| } else { | |
| $xfer += $input->skip($ftype); | |
| } | |
| break; | |
| default: | |
| $xfer += $input->skip($ftype); | |
| break; | |
| } | |
| $xfer += $input->readFieldEnd(); | |
| } | |
| $xfer += $input->readStructEnd(); | |
| return $xfer; | |
| } | |
| public function write($output) { | |
| $xfer = 0; | |
| $xfer += $output->writeStructBegin('User'); | |
| if ($this->firstname !== null) { | |
| $xfer += $output->writeFieldBegin('firstname', TType::STRING, 1); | |
| $xfer += $output->writeString($this->firstname); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| if ($this->lastname !== null) { | |
| $xfer += $output->writeFieldBegin('lastname', TType::STRING, 2); | |
| $xfer += $output->writeString($this->lastname); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| if ($this->user_id !== null) { | |
| $xfer += $output->writeFieldBegin('user_id', TType::I32, 3); | |
| $xfer += $output->writeI32($this->user_id); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| if ($this->sex !== null) { | |
| $xfer += $output->writeFieldBegin('sex', TType::I32, 4); | |
| $xfer += $output->writeI32($this->sex); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| if ($this->active !== null) { | |
| $xfer += $output->writeFieldBegin('active', TType::BOOL, 5); | |
| $xfer += $output->writeBool($this->active); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| if ($this->description !== null) { | |
| $xfer += $output->writeFieldBegin('description', TType::STRING, 6); | |
| $xfer += $output->writeString($this->description); | |
| $xfer += $output->writeFieldEnd(); | |
| } | |
| $xfer += $output->writeFieldStop(); | |
| $xfer += $output->writeStructEnd(); | |
| return $xfer; | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #import <Foundation/Foundation.h> | |
| #import "TProtocol.h" | |
| #import "TApplicationException.h" | |
| #import "TProtocolUtil.h" | |
| #import "TProcessor.h" | |
| #import "TObjective-C.h" | |
| enum SexType { | |
| SexType_MALE = 1, | |
| SexType_FEMALE = 2 | |
| }; | |
| @interface User : NSObject <NSCoding> { | |
| NSString * __firstname; | |
| NSString * __lastname; | |
| int32_t __user_id; | |
| int __sex; | |
| BOOL __active; | |
| NSString * __description; | |
| BOOL __firstname_isset; | |
| BOOL __lastname_isset; | |
| BOOL __user_id_isset; | |
| BOOL __sex_isset; | |
| BOOL __active_isset; | |
| BOOL __description_isset; | |
| } | |
| #if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) | |
| @property (nonatomic, retain, getter=firstname, setter=setFirstname:) NSString * firstname; | |
| @property (nonatomic, retain, getter=lastname, setter=setLastname:) NSString * lastname; | |
| @property (nonatomic, getter=user_id, setter=setUser_id:) int32_t user_id; | |
| @property (nonatomic, getter=sex, setter=setSex:) int sex; | |
| @property (nonatomic, getter=active, setter=setActive:) BOOL active; | |
| @property (nonatomic, retain, getter=description, setter=setDescription:) NSString * description; | |
| #endif | |
| - (id) init; | |
| - (id) initWithFirstname: (NSString *) firstname lastname: (NSString *) lastname user_id: (int32_t) user_id sex: (int) sex active: (BOOL) active description: (NSString *) description; | |
| - (void) read: (id <TProtocol>) inProtocol; | |
| - (void) write: (id <TProtocol>) outProtocol; | |
| #if !__has_feature(objc_arc) | |
| - (NSString *) firstname; | |
| - (void) setFirstname: (NSString *) firstname; | |
| #endif | |
| - (BOOL) firstnameIsSet; | |
| #if !__has_feature(objc_arc) | |
| - (NSString *) lastname; | |
| - (void) setLastname: (NSString *) lastname; | |
| #endif | |
| - (BOOL) lastnameIsSet; | |
| #if !__has_feature(objc_arc) | |
| - (int32_t) user_id; | |
| - (void) setUser_id: (int32_t) user_id; | |
| #endif | |
| - (BOOL) user_idIsSet; | |
| #if !__has_feature(objc_arc) | |
| - (int) sex; | |
| - (void) setSex: (int) sex; | |
| #endif | |
| - (BOOL) sexIsSet; | |
| #if !__has_feature(objc_arc) | |
| - (BOOL) active; | |
| - (void) setActive: (BOOL) active; | |
| #endif | |
| - (BOOL) activeIsSet; | |
| #if !__has_feature(objc_arc) | |
| - (NSString *) description; | |
| - (void) setDescription: (NSString *) description; | |
| #endif | |
| - (BOOL) descriptionIsSet; | |
| @end | |
| @interface UserConstants : NSObject { | |
| } | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| import org.apache.thrift.scheme.IScheme; | |
| import org.apache.thrift.scheme.SchemeFactory; | |
| import org.apache.thrift.scheme.StandardScheme; | |
| import org.apache.thrift.scheme.TupleScheme; | |
| import org.apache.thrift.protocol.TTupleProtocol; | |
| import org.apache.thrift.protocol.TProtocolException; | |
| import org.apache.thrift.EncodingUtils; | |
| import org.apache.thrift.TException; | |
| import java.util.List; | |
| import java.util.ArrayList; | |
| import java.util.Map; | |
| import java.util.HashMap; | |
| import java.util.EnumMap; | |
| import java.util.Set; | |
| import java.util.HashSet; | |
| import java.util.EnumSet; | |
| import java.util.Collections; | |
| import java.util.BitSet; | |
| import java.nio.ByteBuffer; | |
| import java.util.Arrays; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| public class User implements org.apache.thrift.TBase<User, User._Fields>, java.io.Serializable, Cloneable { | |
| 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 FIRSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("firstname", org.apache.thrift.protocol.TType.STRING, (short)1); | |
| private static final org.apache.thrift.protocol.TField LASTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastname", org.apache.thrift.protocol.TType.STRING, (short)2); | |
| private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("user_id", org.apache.thrift.protocol.TType.I32, (short)3); | |
| 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)4); | |
| private static final org.apache.thrift.protocol.TField ACTIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("active", org.apache.thrift.protocol.TType.BOOL, (short)5); | |
| private static final org.apache.thrift.protocol.TField DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", org.apache.thrift.protocol.TType.STRING, (short)6); | |
| private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); | |
| static { | |
| schemes.put(StandardScheme.class, new UserStandardSchemeFactory()); | |
| schemes.put(TupleScheme.class, new UserTupleSchemeFactory()); | |
| } | |
| public String firstname; // required | |
| public String lastname; // required | |
| public int user_id; // required | |
| /** | |
| * | |
| * @see SexType | |
| */ | |
| public SexType sex; // required | |
| public boolean active; // required | |
| public String description; // optional | |
| /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ | |
| public enum _Fields implements org.apache.thrift.TFieldIdEnum { | |
| FIRSTNAME((short)1, "firstname"), | |
| LASTNAME((short)2, "lastname"), | |
| USER_ID((short)3, "user_id"), | |
| /** | |
| * | |
| * @see SexType | |
| */ | |
| SEX((short)4, "sex"), | |
| ACTIVE((short)5, "active"), | |
| DESCRIPTION((short)6, "description"); | |
| private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); | |
| static { | |
| for (_Fields field : EnumSet.allOf(_Fields.class)) { | |
| byName.put(field.getFieldName(), field); | |
| } | |
| } | |
| /** | |
| * Find the _Fields constant that matches fieldId, or null if its not found. | |
| */ | |
| public static _Fields findByThriftId(int fieldId) { | |
| switch(fieldId) { | |
| case 1: // FIRSTNAME | |
| return FIRSTNAME; | |
| case 2: // LASTNAME | |
| return LASTNAME; | |
| case 3: // USER_ID | |
| return USER_ID; | |
| case 4: // SEX | |
| return SEX; | |
| case 5: // ACTIVE | |
| return ACTIVE; | |
| case 6: // DESCRIPTION | |
| return DESCRIPTION; | |
| default: | |
| return null; | |
| } | |
| } | |
| /** | |
| * Find the _Fields constant that matches fieldId, throwing an exception | |
| * if it is not found. | |
| */ | |
| public static _Fields findByThriftIdOrThrow(int fieldId) { | |
| _Fields fields = findByThriftId(fieldId); | |
| if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); | |
| return fields; | |
| } | |
| /** | |
| * Find the _Fields constant that matches name, or null if its not found. | |
| */ | |
| public static _Fields findByName(String name) { | |
| return byName.get(name); | |
| } | |
| private final short _thriftId; | |
| private final String _fieldName; | |
| _Fields(short thriftId, String fieldName) { | |
| _thriftId = thriftId; | |
| _fieldName = fieldName; | |
| } | |
| public short getThriftFieldId() { | |
| return _thriftId; | |
| } | |
| public String getFieldName() { | |
| return _fieldName; | |
| } | |
| } | |
| // isset id assignments | |
| private static final int __USER_ID_ISSET_ID = 0; | |
| private static final int __ACTIVE_ISSET_ID = 1; | |
| private byte __isset_bitfield = 0; | |
| private _Fields optionals[] = {_Fields.DESCRIPTION}; | |
| public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; | |
| static { | |
| Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); | |
| tmpMap.put(_Fields.FIRSTNAME, new org.apache.thrift.meta_data.FieldMetaData("firstname", org.apache.thrift.TFieldRequirementType.DEFAULT, | |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); | |
| tmpMap.put(_Fields.LASTNAME, new org.apache.thrift.meta_data.FieldMetaData("lastname", org.apache.thrift.TFieldRequirementType.DEFAULT, | |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); | |
| tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("user_id", org.apache.thrift.TFieldRequirementType.DEFAULT, | |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); | |
| tmpMap.put(_Fields.SEX, new org.apache.thrift.meta_data.FieldMetaData("sex", org.apache.thrift.TFieldRequirementType.DEFAULT, | |
| new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SexType.class))); | |
| tmpMap.put(_Fields.ACTIVE, new org.apache.thrift.meta_data.FieldMetaData("active", org.apache.thrift.TFieldRequirementType.DEFAULT, | |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); | |
| tmpMap.put(_Fields.DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("description", org.apache.thrift.TFieldRequirementType.OPTIONAL, | |
| new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); | |
| metaDataMap = Collections.unmodifiableMap(tmpMap); | |
| org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(User.class, metaDataMap); | |
| } | |
| public User() { | |
| this.user_id = 0; | |
| this.active = false; | |
| } | |
| public User( | |
| String firstname, | |
| String lastname, | |
| int user_id, | |
| SexType sex, | |
| boolean active) | |
| { | |
| this(); | |
| this.firstname = firstname; | |
| this.lastname = lastname; | |
| this.user_id = user_id; | |
| setUser_idIsSet(true); | |
| this.sex = sex; | |
| this.active = active; | |
| setActiveIsSet(true); | |
| } | |
| /** | |
| * Performs a deep copy on <i>other</i>. | |
| */ | |
| public User(User other) { | |
| __isset_bitfield = other.__isset_bitfield; | |
| if (other.isSetFirstname()) { | |
| this.firstname = other.firstname; | |
| } | |
| if (other.isSetLastname()) { | |
| this.lastname = other.lastname; | |
| } | |
| this.user_id = other.user_id; | |
| if (other.isSetSex()) { | |
| this.sex = other.sex; | |
| } | |
| this.active = other.active; | |
| if (other.isSetDescription()) { | |
| this.description = other.description; | |
| } | |
| } | |
| public User deepCopy() { | |
| return new User(this); | |
| } | |
| @Override | |
| public void clear() { | |
| this.firstname = null; | |
| this.lastname = null; | |
| this.user_id = 0; | |
| this.sex = null; | |
| this.active = false; | |
| this.description = null; | |
| } | |
| public String getFirstname() { | |
| return this.firstname; | |
| } | |
| public User setFirstname(String firstname) { | |
| this.firstname = firstname; | |
| return this; | |
| } | |
| public void unsetFirstname() { | |
| this.firstname = null; | |
| } | |
| /** Returns true if field firstname is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetFirstname() { | |
| return this.firstname != null; | |
| } | |
| public void setFirstnameIsSet(boolean value) { | |
| if (!value) { | |
| this.firstname = null; | |
| } | |
| } | |
| public String getLastname() { | |
| return this.lastname; | |
| } | |
| public User setLastname(String lastname) { | |
| this.lastname = lastname; | |
| return this; | |
| } | |
| public void unsetLastname() { | |
| this.lastname = null; | |
| } | |
| /** Returns true if field lastname is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetLastname() { | |
| return this.lastname != null; | |
| } | |
| public void setLastnameIsSet(boolean value) { | |
| if (!value) { | |
| this.lastname = null; | |
| } | |
| } | |
| public int getUser_id() { | |
| return this.user_id; | |
| } | |
| public User setUser_id(int user_id) { | |
| this.user_id = user_id; | |
| setUser_idIsSet(true); | |
| return this; | |
| } | |
| public void unsetUser_id() { | |
| __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USER_ID_ISSET_ID); | |
| } | |
| /** Returns true if field user_id is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetUser_id() { | |
| return EncodingUtils.testBit(__isset_bitfield, __USER_ID_ISSET_ID); | |
| } | |
| public void setUser_idIsSet(boolean value) { | |
| __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USER_ID_ISSET_ID, value); | |
| } | |
| /** | |
| * | |
| * @see SexType | |
| */ | |
| public SexType getSex() { | |
| return this.sex; | |
| } | |
| /** | |
| * | |
| * @see SexType | |
| */ | |
| public User setSex(SexType sex) { | |
| this.sex = sex; | |
| return this; | |
| } | |
| public void unsetSex() { | |
| this.sex = null; | |
| } | |
| /** Returns true if field sex is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetSex() { | |
| return this.sex != null; | |
| } | |
| public void setSexIsSet(boolean value) { | |
| if (!value) { | |
| this.sex = null; | |
| } | |
| } | |
| public boolean isActive() { | |
| return this.active; | |
| } | |
| public User setActive(boolean active) { | |
| this.active = active; | |
| setActiveIsSet(true); | |
| return this; | |
| } | |
| public void unsetActive() { | |
| __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACTIVE_ISSET_ID); | |
| } | |
| /** Returns true if field active is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetActive() { | |
| return EncodingUtils.testBit(__isset_bitfield, __ACTIVE_ISSET_ID); | |
| } | |
| public void setActiveIsSet(boolean value) { | |
| __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACTIVE_ISSET_ID, value); | |
| } | |
| public String getDescription() { | |
| return this.description; | |
| } | |
| public User setDescription(String description) { | |
| this.description = description; | |
| return this; | |
| } | |
| public void unsetDescription() { | |
| this.description = null; | |
| } | |
| /** Returns true if field description is set (has been assigned a value) and false otherwise */ | |
| public boolean isSetDescription() { | |
| return this.description != null; | |
| } | |
| public void setDescriptionIsSet(boolean value) { | |
| if (!value) { | |
| this.description = null; | |
| } | |
| } | |
| public void setFieldValue(_Fields field, Object value) { | |
| switch (field) { | |
| case FIRSTNAME: | |
| if (value == null) { | |
| unsetFirstname(); | |
| } else { | |
| setFirstname((String)value); | |
| } | |
| break; | |
| case LASTNAME: | |
| if (value == null) { | |
| unsetLastname(); | |
| } else { | |
| setLastname((String)value); | |
| } | |
| break; | |
| case USER_ID: | |
| if (value == null) { | |
| unsetUser_id(); | |
| } else { | |
| setUser_id((Integer)value); | |
| } | |
| break; | |
| case SEX: | |
| if (value == null) { | |
| unsetSex(); | |
| } else { | |
| setSex((SexType)value); | |
| } | |
| break; | |
| case ACTIVE: | |
| if (value == null) { | |
| unsetActive(); | |
| } else { | |
| setActive((Boolean)value); | |
| } | |
| break; | |
| case DESCRIPTION: | |
| if (value == null) { | |
| unsetDescription(); | |
| } else { | |
| setDescription((String)value); | |
| } | |
| break; | |
| } | |
| } | |
| public Object getFieldValue(_Fields field) { | |
| switch (field) { | |
| case FIRSTNAME: | |
| return getFirstname(); | |
| case LASTNAME: | |
| return getLastname(); | |
| case USER_ID: | |
| return Integer.valueOf(getUser_id()); | |
| case SEX: | |
| return getSex(); | |
| case ACTIVE: | |
| return Boolean.valueOf(isActive()); | |
| case DESCRIPTION: | |
| return getDescription(); | |
| } | |
| throw new IllegalStateException(); | |
| } | |
| /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ | |
| public boolean isSet(_Fields field) { | |
| if (field == null) { | |
| throw new IllegalArgumentException(); | |
| } | |
| switch (field) { | |
| case FIRSTNAME: | |
| return isSetFirstname(); | |
| case LASTNAME: | |
| return isSetLastname(); | |
| case USER_ID: | |
| return isSetUser_id(); | |
| case SEX: | |
| return isSetSex(); | |
| case ACTIVE: | |
| return isSetActive(); | |
| case DESCRIPTION: | |
| return isSetDescription(); | |
| } | |
| throw new IllegalStateException(); | |
| } | |
| @Override | |
| public boolean equals(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; | |
| boolean this_present_firstname = true && this.isSetFirstname(); | |
| boolean that_present_firstname = true && that.isSetFirstname(); | |
| if (this_present_firstname || that_present_firstname) { | |
| if (!(this_present_firstname && that_present_firstname)) | |
| return false; | |
| if (!this.firstname.equals(that.firstname)) | |
| return false; | |
| } | |
| boolean this_present_lastname = true && this.isSetLastname(); | |
| boolean that_present_lastname = true && that.isSetLastname(); | |
| if (this_present_lastname || that_present_lastname) { | |
| if (!(this_present_lastname && that_present_lastname)) | |
| return false; | |
| if (!this.lastname.equals(that.lastname)) | |
| return false; | |
| } | |
| boolean this_present_user_id = true; | |
| boolean that_present_user_id = true; | |
| if (this_present_user_id || that_present_user_id) { | |
| if (!(this_present_user_id && that_present_user_id)) | |
| return false; | |
| if (this.user_id != that.user_id) | |
| return false; | |
| } | |
| boolean this_present_sex = true && this.isSetSex(); | |
| boolean that_present_sex = true && that.isSetSex(); | |
| if (this_present_sex || that_present_sex) { | |
| if (!(this_present_sex && that_present_sex)) | |
| return false; | |
| if (!this.sex.equals(that.sex)) | |
| return false; | |
| } | |
| boolean this_present_active = true; | |
| boolean that_present_active = true; | |
| if (this_present_active || that_present_active) { | |
| if (!(this_present_active && that_present_active)) | |
| return false; | |
| if (this.active != that.active) | |
| return false; | |
| } | |
| boolean this_present_description = true && this.isSetDescription(); | |
| boolean that_present_description = true && that.isSetDescription(); | |
| if (this_present_description || that_present_description) { | |
| if (!(this_present_description && that_present_description)) | |
| return false; | |
| if (!this.description.equals(that.description)) | |
| return false; | |
| } | |
| return true; | |
| } | |
| @Override | |
| public int hashCode() { | |
| return 0; | |
| } | |
| public int compareTo(User other) { | |
| if (!getClass().equals(other.getClass())) { | |
| return getClass().getName().compareTo(other.getClass().getName()); | |
| } | |
| int lastComparison = 0; | |
| User typedOther = (User)other; | |
| lastComparison = Boolean.valueOf(isSetFirstname()).compareTo(typedOther.isSetFirstname()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetFirstname()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstname, typedOther.firstname); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| } | |
| lastComparison = Boolean.valueOf(isSetLastname()).compareTo(typedOther.isSetLastname()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetLastname()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastname, typedOther.lastname); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| } | |
| lastComparison = Boolean.valueOf(isSetUser_id()).compareTo(typedOther.isSetUser_id()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetUser_id()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user_id, typedOther.user_id); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| } | |
| lastComparison = Boolean.valueOf(isSetSex()).compareTo(typedOther.isSetSex()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetSex()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sex, typedOther.sex); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| } | |
| lastComparison = Boolean.valueOf(isSetActive()).compareTo(typedOther.isSetActive()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetActive()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.active, typedOther.active); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| } | |
| lastComparison = Boolean.valueOf(isSetDescription()).compareTo(typedOther.isSetDescription()); | |
| if (lastComparison != 0) { | |
| return lastComparison; | |
| } | |
| if (isSetDescription()) { | |
| lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.description, typedOther.description); | |
| 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 { | |
| schemes.get(iprot.getScheme()).getScheme().read(iprot, this); | |
| } | |
| public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { | |
| schemes.get(oprot.getScheme()).getScheme().write(oprot, this); | |
| } | |
| @Override | |
| public String toString() { | |
| StringBuilder sb = new StringBuilder("User("); | |
| boolean first = true; | |
| sb.append("firstname:"); | |
| if (this.firstname == null) { | |
| sb.append("null"); | |
| } else { | |
| sb.append(this.firstname); | |
| } | |
| first = false; | |
| if (!first) sb.append(", "); | |
| sb.append("lastname:"); | |
| if (this.lastname == null) { | |
| sb.append("null"); | |
| } else { | |
| sb.append(this.lastname); | |
| } | |
| first = false; | |
| if (!first) sb.append(", "); | |
| sb.append("user_id:"); | |
| sb.append(this.user_id); | |
| first = false; | |
| if (!first) sb.append(", "); | |
| sb.append("sex:"); | |
| if (this.sex == null) { | |
| sb.append("null"); | |
| } else { | |
| sb.append(this.sex); | |
| } | |
| first = false; | |
| if (!first) sb.append(", "); | |
| sb.append("active:"); | |
| sb.append(this.active); | |
| first = false; | |
| if (isSetDescription()) { | |
| if (!first) sb.append(", "); | |
| sb.append("description:"); | |
| if (this.description == null) { | |
| sb.append("null"); | |
| } else { | |
| sb.append(this.description); | |
| } | |
| 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, 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 SchemeFactory { | |
| public UserStandardScheme getScheme() { | |
| return new UserStandardScheme(); | |
| } | |
| } | |
| private static class UserStandardScheme extends 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: // FIRSTNAME | |
| if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { | |
| struct.firstname = iprot.readString(); | |
| struct.setFirstnameIsSet(true); | |
| } else { | |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); | |
| } | |
| break; | |
| case 2: // LASTNAME | |
| if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { | |
| struct.lastname = iprot.readString(); | |
| struct.setLastnameIsSet(true); | |
| } else { | |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); | |
| } | |
| break; | |
| case 3: // USER_ID | |
| if (schemeField.type == org.apache.thrift.protocol.TType.I32) { | |
| struct.user_id = iprot.readI32(); | |
| struct.setUser_idIsSet(true); | |
| } else { | |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); | |
| } | |
| break; | |
| case 4: // SEX | |
| if (schemeField.type == org.apache.thrift.protocol.TType.I32) { | |
| struct.sex = SexType.findByValue(iprot.readI32()); | |
| struct.setSexIsSet(true); | |
| } else { | |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); | |
| } | |
| break; | |
| case 5: // ACTIVE | |
| if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { | |
| struct.active = iprot.readBool(); | |
| struct.setActiveIsSet(true); | |
| } else { | |
| org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); | |
| } | |
| break; | |
| case 6: // DESCRIPTION | |
| if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { | |
| struct.description = iprot.readString(); | |
| struct.setDescriptionIsSet(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); | |
| if (struct.firstname != null) { | |
| oprot.writeFieldBegin(FIRSTNAME_FIELD_DESC); | |
| oprot.writeString(struct.firstname); | |
| oprot.writeFieldEnd(); | |
| } | |
| if (struct.lastname != null) { | |
| oprot.writeFieldBegin(LASTNAME_FIELD_DESC); | |
| oprot.writeString(struct.lastname); | |
| oprot.writeFieldEnd(); | |
| } | |
| oprot.writeFieldBegin(USER_ID_FIELD_DESC); | |
| oprot.writeI32(struct.user_id); | |
| oprot.writeFieldEnd(); | |
| if (struct.sex != null) { | |
| oprot.writeFieldBegin(SEX_FIELD_DESC); | |
| oprot.writeI32(struct.sex.getValue()); | |
| oprot.writeFieldEnd(); | |
| } | |
| oprot.writeFieldBegin(ACTIVE_FIELD_DESC); | |
| oprot.writeBool(struct.active); | |
| oprot.writeFieldEnd(); | |
| if (struct.description != null) { | |
| if (struct.isSetDescription()) { | |
| oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC); | |
| oprot.writeString(struct.description); | |
| oprot.writeFieldEnd(); | |
| } | |
| } | |
| oprot.writeFieldStop(); | |
| oprot.writeStructEnd(); | |
| } | |
| } | |
| private static class UserTupleSchemeFactory implements SchemeFactory { | |
| public UserTupleScheme getScheme() { | |
| return new UserTupleScheme(); | |
| } | |
| } | |
| private static class UserTupleScheme extends TupleScheme<User> { | |
| @Override | |
| public void write(org.apache.thrift.protocol.TProtocol prot, User struct) throws org.apache.thrift.TException { | |
| TTupleProtocol oprot = (TTupleProtocol) prot; | |
| BitSet optionals = new BitSet(); | |
| if (struct.isSetFirstname()) { | |
| optionals.set(0); | |
| } | |
| if (struct.isSetLastname()) { | |
| optionals.set(1); | |
| } | |
| if (struct.isSetUser_id()) { | |
| optionals.set(2); | |
| } | |
| if (struct.isSetSex()) { | |
| optionals.set(3); | |
| } | |
| if (struct.isSetActive()) { | |
| optionals.set(4); | |
| } | |
| if (struct.isSetDescription()) { | |
| optionals.set(5); | |
| } | |
| oprot.writeBitSet(optionals, 6); | |
| if (struct.isSetFirstname()) { | |
| oprot.writeString(struct.firstname); | |
| } | |
| if (struct.isSetLastname()) { | |
| oprot.writeString(struct.lastname); | |
| } | |
| if (struct.isSetUser_id()) { | |
| oprot.writeI32(struct.user_id); | |
| } | |
| if (struct.isSetSex()) { | |
| oprot.writeI32(struct.sex.getValue()); | |
| } | |
| if (struct.isSetActive()) { | |
| oprot.writeBool(struct.active); | |
| } | |
| if (struct.isSetDescription()) { | |
| oprot.writeString(struct.description); | |
| } | |
| } | |
| @Override | |
| public void read(org.apache.thrift.protocol.TProtocol prot, User struct) throws org.apache.thrift.TException { | |
| TTupleProtocol iprot = (TTupleProtocol) prot; | |
| BitSet incoming = iprot.readBitSet(6); | |
| if (incoming.get(0)) { | |
| struct.firstname = iprot.readString(); | |
| struct.setFirstnameIsSet(true); | |
| } | |
| if (incoming.get(1)) { | |
| struct.lastname = iprot.readString(); | |
| struct.setLastnameIsSet(true); | |
| } | |
| if (incoming.get(2)) { | |
| struct.user_id = iprot.readI32(); | |
| struct.setUser_idIsSet(true); | |
| } | |
| if (incoming.get(3)) { | |
| struct.sex = SexType.findByValue(iprot.readI32()); | |
| struct.setSexIsSet(true); | |
| } | |
| if (incoming.get(4)) { | |
| struct.active = iprot.readBool(); | |
| struct.setActiveIsSet(true); | |
| } | |
| if (incoming.get(5)) { | |
| struct.description = iprot.readString(); | |
| struct.setDescriptionIsSet(true); | |
| } | |
| } | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #import <Foundation/Foundation.h> | |
| #import "TProtocol.h" | |
| #import "TApplicationException.h" | |
| #import "TProtocolUtil.h" | |
| #import "TProcessor.h" | |
| #import "TObjective-C.h" | |
| #import "User.h" | |
| @implementation User | |
| - (id) init | |
| { | |
| self = [super init]; | |
| #if TARGET_OS_IPHONE || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) | |
| self.user_id = 0; | |
| self.active = NO; | |
| #endif | |
| return self; | |
| } | |
| - (id) initWithFirstname: (NSString *) firstname lastname: (NSString *) lastname user_id: (int32_t) user_id sex: (int) sex active: (BOOL) active description: (NSString *) description | |
| { | |
| self = [super init]; | |
| __firstname = [firstname retain_stub]; | |
| __firstname_isset = YES; | |
| __lastname = [lastname retain_stub]; | |
| __lastname_isset = YES; | |
| __user_id = user_id; | |
| __user_id_isset = YES; | |
| __sex = sex; | |
| __sex_isset = YES; | |
| __active = active; | |
| __active_isset = YES; | |
| __description = [description retain_stub]; | |
| __description_isset = YES; | |
| return self; | |
| } | |
| - (id) initWithCoder: (NSCoder *) decoder | |
| { | |
| self = [super init]; | |
| if ([decoder containsValueForKey: @"firstname"]) | |
| { | |
| __firstname = [[decoder decodeObjectForKey: @"firstname"] retain_stub]; | |
| __firstname_isset = YES; | |
| } | |
| if ([decoder containsValueForKey: @"lastname"]) | |
| { | |
| __lastname = [[decoder decodeObjectForKey: @"lastname"] retain_stub]; | |
| __lastname_isset = YES; | |
| } | |
| if ([decoder containsValueForKey: @"user_id"]) | |
| { | |
| __user_id = [decoder decodeInt32ForKey: @"user_id"]; | |
| __user_id_isset = YES; | |
| } | |
| if ([decoder containsValueForKey: @"sex"]) | |
| { | |
| __sex = [decoder decodeIntForKey: @"sex"]; | |
| __sex_isset = YES; | |
| } | |
| if ([decoder containsValueForKey: @"active"]) | |
| { | |
| __active = [decoder decodeBoolForKey: @"active"]; | |
| __active_isset = YES; | |
| } | |
| if ([decoder containsValueForKey: @"description"]) | |
| { | |
| __description = [[decoder decodeObjectForKey: @"description"] retain_stub]; | |
| __description_isset = YES; | |
| } | |
| return self; | |
| } | |
| - (void) encodeWithCoder: (NSCoder *) encoder | |
| { | |
| if (__firstname_isset) | |
| { | |
| [encoder encodeObject: __firstname forKey: @"firstname"]; | |
| } | |
| if (__lastname_isset) | |
| { | |
| [encoder encodeObject: __lastname forKey: @"lastname"]; | |
| } | |
| if (__user_id_isset) | |
| { | |
| [encoder encodeInt32: __user_id forKey: @"user_id"]; | |
| } | |
| if (__sex_isset) | |
| { | |
| [encoder encodeInt: __sex forKey: @"sex"]; | |
| } | |
| if (__active_isset) | |
| { | |
| [encoder encodeBool: __active forKey: @"active"]; | |
| } | |
| if (__description_isset) | |
| { | |
| [encoder encodeObject: __description forKey: @"description"]; | |
| } | |
| } | |
| - (void) dealloc | |
| { | |
| [__firstname release_stub]; | |
| [__lastname release_stub]; | |
| [__description release_stub]; | |
| [super dealloc_stub]; | |
| } | |
| - (NSString *) firstname { | |
| return [[__firstname retain_stub] autorelease_stub]; | |
| } | |
| - (void) setFirstname: (NSString *) firstname { | |
| [firstname retain_stub]; | |
| [__firstname release_stub]; | |
| __firstname = firstname; | |
| __firstname_isset = YES; | |
| } | |
| - (BOOL) firstnameIsSet { | |
| return __firstname_isset; | |
| } | |
| - (void) unsetFirstname { | |
| [__firstname release_stub]; | |
| __firstname = nil; | |
| __firstname_isset = NO; | |
| } | |
| - (NSString *) lastname { | |
| return [[__lastname retain_stub] autorelease_stub]; | |
| } | |
| - (void) setLastname: (NSString *) lastname { | |
| [lastname retain_stub]; | |
| [__lastname release_stub]; | |
| __lastname = lastname; | |
| __lastname_isset = YES; | |
| } | |
| - (BOOL) lastnameIsSet { | |
| return __lastname_isset; | |
| } | |
| - (void) unsetLastname { | |
| [__lastname release_stub]; | |
| __lastname = nil; | |
| __lastname_isset = NO; | |
| } | |
| - (int32_t) user_id { | |
| return __user_id; | |
| } | |
| - (void) setUser_id: (int32_t) user_id { | |
| __user_id = user_id; | |
| __user_id_isset = YES; | |
| } | |
| - (BOOL) user_idIsSet { | |
| return __user_id_isset; | |
| } | |
| - (void) unsetUser_id { | |
| __user_id_isset = NO; | |
| } | |
| - (int) sex { | |
| return __sex; | |
| } | |
| - (void) setSex: (int) sex { | |
| __sex = sex; | |
| __sex_isset = YES; | |
| } | |
| - (BOOL) sexIsSet { | |
| return __sex_isset; | |
| } | |
| - (void) unsetSex { | |
| __sex_isset = NO; | |
| } | |
| - (BOOL) active { | |
| return __active; | |
| } | |
| - (void) setActive: (BOOL) active { | |
| __active = active; | |
| __active_isset = YES; | |
| } | |
| - (BOOL) activeIsSet { | |
| return __active_isset; | |
| } | |
| - (void) unsetActive { | |
| __active_isset = NO; | |
| } | |
| - (NSString *) description { | |
| return [[__description retain_stub] autorelease_stub]; | |
| } | |
| - (void) setDescription: (NSString *) description { | |
| [description retain_stub]; | |
| [__description release_stub]; | |
| __description = description; | |
| __description_isset = YES; | |
| } | |
| - (BOOL) descriptionIsSet { | |
| return __description_isset; | |
| } | |
| - (void) unsetDescription { | |
| [__description release_stub]; | |
| __description = nil; | |
| __description_isset = NO; | |
| } | |
| - (void) read: (id <TProtocol>) inProtocol | |
| { | |
| NSString * fieldName; | |
| int fieldType; | |
| int fieldID; | |
| [inProtocol readStructBeginReturningName: NULL]; | |
| while (true) | |
| { | |
| [inProtocol readFieldBeginReturningName: &fieldName type: &fieldType fieldID: &fieldID]; | |
| if (fieldType == TType_STOP) { | |
| break; | |
| } | |
| switch (fieldID) | |
| { | |
| case 1: | |
| if (fieldType == TType_STRING) { | |
| NSString * fieldValue = [inProtocol readString]; | |
| [self setFirstname: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| case 2: | |
| if (fieldType == TType_STRING) { | |
| NSString * fieldValue = [inProtocol readString]; | |
| [self setLastname: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| case 3: | |
| if (fieldType == TType_I32) { | |
| int32_t fieldValue = [inProtocol readI32]; | |
| [self setUser_id: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| case 4: | |
| if (fieldType == TType_I32) { | |
| int fieldValue = [inProtocol readI32]; | |
| [self setSex: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| case 5: | |
| if (fieldType == TType_BOOL) { | |
| BOOL fieldValue = [inProtocol readBool]; | |
| [self setActive: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| case 6: | |
| if (fieldType == TType_STRING) { | |
| NSString * fieldValue = [inProtocol readString]; | |
| [self setDescription: fieldValue]; | |
| } else { | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| } | |
| break; | |
| default: | |
| [TProtocolUtil skipType: fieldType onProtocol: inProtocol]; | |
| break; | |
| } | |
| [inProtocol readFieldEnd]; | |
| } | |
| [inProtocol readStructEnd]; | |
| } | |
| - (void) write: (id <TProtocol>) outProtocol { | |
| [outProtocol writeStructBeginWithName: @"User"]; | |
| if (__firstname_isset) { | |
| if (__firstname != nil) { | |
| [outProtocol writeFieldBeginWithName: @"firstname" type: TType_STRING fieldID: 1]; | |
| [outProtocol writeString: __firstname]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| } | |
| if (__lastname_isset) { | |
| if (__lastname != nil) { | |
| [outProtocol writeFieldBeginWithName: @"lastname" type: TType_STRING fieldID: 2]; | |
| [outProtocol writeString: __lastname]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| } | |
| if (__user_id_isset) { | |
| [outProtocol writeFieldBeginWithName: @"user_id" type: TType_I32 fieldID: 3]; | |
| [outProtocol writeI32: __user_id]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| if (__sex_isset) { | |
| [outProtocol writeFieldBeginWithName: @"sex" type: TType_I32 fieldID: 4]; | |
| [outProtocol writeI32: __sex]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| if (__active_isset) { | |
| [outProtocol writeFieldBeginWithName: @"active" type: TType_BOOL fieldID: 5]; | |
| [outProtocol writeBool: __active]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| if (__description_isset) { | |
| if (__description != nil) { | |
| [outProtocol writeFieldBeginWithName: @"description" type: TType_STRING fieldID: 6]; | |
| [outProtocol writeString: __description]; | |
| [outProtocol writeFieldEnd]; | |
| } | |
| } | |
| [outProtocol writeFieldStop]; | |
| [outProtocol writeStructEnd]; | |
| } | |
| - (NSString *) description { | |
| NSMutableString * ms = [NSMutableString stringWithString: @"User("]; | |
| [ms appendString: @"firstname:"]; | |
| [ms appendFormat: @"\"%@\"", __firstname]; | |
| [ms appendString: @",lastname:"]; | |
| [ms appendFormat: @"\"%@\"", __lastname]; | |
| [ms appendString: @",user_id:"]; | |
| [ms appendFormat: @"%i", __user_id]; | |
| [ms appendString: @",sex:"]; | |
| [ms appendFormat: @"%i", __sex]; | |
| [ms appendString: @",active:"]; | |
| [ms appendFormat: @"%i", __active]; | |
| [ms appendString: @",description:"]; | |
| [ms appendFormat: @"\"%@\"", __description]; | |
| [ms appendString: @")"]; | |
| return [NSString stringWithString: ms]; | |
| } | |
| @end | |
| @implementation UserConstants | |
| + (void) initialize { | |
| } | |
| @end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum SexType { | |
| MALE = 1, | |
| FEMALE = 2 | |
| } | |
| struct User { | |
| 1: string firstname, | |
| 2: string lastname, | |
| 3: i32 user_id = 0, | |
| 4: SexType sex, | |
| 5: bool active = false, | |
| 6: optional string description | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #include "User_constants.h" | |
| const UserConstants g_User_constants; | |
| UserConstants::UserConstants() { | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #ifndef User_CONSTANTS_H | |
| #define User_CONSTANTS_H | |
| #include "User_types.h" | |
| class UserConstants { | |
| public: | |
| UserConstants(); | |
| }; | |
| extern const UserConstants g_User_constants; | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Autogenerated by Thrift Compiler (0.9.0) | |
| # | |
| # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| # | |
| require 'thrift' | |
| require 'user_types' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #include "User_types.h" | |
| #include <algorithm> | |
| int _kSexTypeValues[] = { | |
| SexType::MALE, | |
| SexType::FEMALE | |
| }; | |
| const char* _kSexTypeNames[] = { | |
| "MALE", | |
| "FEMALE" | |
| }; | |
| const std::map<int, const char*> _SexType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kSexTypeValues, _kSexTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); | |
| const char* User::ascii_fingerprint = "91A4D70357F54081AD8F263E934234C0"; | |
| const uint8_t User::binary_fingerprint[16] = {0x91,0xA4,0xD7,0x03,0x57,0xF5,0x40,0x81,0xAD,0x8F,0x26,0x3E,0x93,0x42,0x34,0xC0}; | |
| uint32_t User::read(::apache::thrift::protocol::TProtocol* iprot) { | |
| uint32_t xfer = 0; | |
| std::string fname; | |
| ::apache::thrift::protocol::TType ftype; | |
| int16_t fid; | |
| xfer += iprot->readStructBegin(fname); | |
| using ::apache::thrift::protocol::TProtocolException; | |
| while (true) | |
| { | |
| xfer += iprot->readFieldBegin(fname, ftype, fid); | |
| if (ftype == ::apache::thrift::protocol::T_STOP) { | |
| break; | |
| } | |
| switch (fid) | |
| { | |
| case 1: | |
| if (ftype == ::apache::thrift::protocol::T_STRING) { | |
| xfer += iprot->readString(this->firstname); | |
| this->__isset.firstname = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| case 2: | |
| if (ftype == ::apache::thrift::protocol::T_STRING) { | |
| xfer += iprot->readString(this->lastname); | |
| this->__isset.lastname = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| case 3: | |
| if (ftype == ::apache::thrift::protocol::T_I32) { | |
| xfer += iprot->readI32(this->user_id); | |
| this->__isset.user_id = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| case 4: | |
| if (ftype == ::apache::thrift::protocol::T_I32) { | |
| int32_t ecast0; | |
| xfer += iprot->readI32(ecast0); | |
| this->sex = (SexType::type)ecast0; | |
| this->__isset.sex = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| case 5: | |
| if (ftype == ::apache::thrift::protocol::T_BOOL) { | |
| xfer += iprot->readBool(this->active); | |
| this->__isset.active = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| case 6: | |
| if (ftype == ::apache::thrift::protocol::T_STRING) { | |
| xfer += iprot->readString(this->description); | |
| this->__isset.description = true; | |
| } else { | |
| xfer += iprot->skip(ftype); | |
| } | |
| break; | |
| default: | |
| xfer += iprot->skip(ftype); | |
| break; | |
| } | |
| xfer += iprot->readFieldEnd(); | |
| } | |
| xfer += iprot->readStructEnd(); | |
| return xfer; | |
| } | |
| uint32_t User::write(::apache::thrift::protocol::TProtocol* oprot) const { | |
| uint32_t xfer = 0; | |
| xfer += oprot->writeStructBegin("User"); | |
| xfer += oprot->writeFieldBegin("firstname", ::apache::thrift::protocol::T_STRING, 1); | |
| xfer += oprot->writeString(this->firstname); | |
| xfer += oprot->writeFieldEnd(); | |
| xfer += oprot->writeFieldBegin("lastname", ::apache::thrift::protocol::T_STRING, 2); | |
| xfer += oprot->writeString(this->lastname); | |
| xfer += oprot->writeFieldEnd(); | |
| xfer += oprot->writeFieldBegin("user_id", ::apache::thrift::protocol::T_I32, 3); | |
| xfer += oprot->writeI32(this->user_id); | |
| xfer += oprot->writeFieldEnd(); | |
| xfer += oprot->writeFieldBegin("sex", ::apache::thrift::protocol::T_I32, 4); | |
| xfer += oprot->writeI32((int32_t)this->sex); | |
| xfer += oprot->writeFieldEnd(); | |
| xfer += oprot->writeFieldBegin("active", ::apache::thrift::protocol::T_BOOL, 5); | |
| xfer += oprot->writeBool(this->active); | |
| xfer += oprot->writeFieldEnd(); | |
| if (this->__isset.description) { | |
| xfer += oprot->writeFieldBegin("description", ::apache::thrift::protocol::T_STRING, 6); | |
| xfer += oprot->writeString(this->description); | |
| xfer += oprot->writeFieldEnd(); | |
| } | |
| xfer += oprot->writeFieldStop(); | |
| xfer += oprot->writeStructEnd(); | |
| return xfer; | |
| } | |
| void swap(User &a, User &b) { | |
| using ::std::swap; | |
| swap(a.firstname, b.firstname); | |
| swap(a.lastname, b.lastname); | |
| swap(a.user_id, b.user_id); | |
| swap(a.sex, b.sex); | |
| swap(a.active, b.active); | |
| swap(a.description, b.description); | |
| swap(a.__isset, b.__isset); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Autogenerated by Thrift Compiler (0.9.0) | |
| * | |
| * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| * @generated | |
| */ | |
| #ifndef User_TYPES_H | |
| #define User_TYPES_H | |
| #include <thrift/Thrift.h> | |
| #include <thrift/TApplicationException.h> | |
| #include <thrift/protocol/TProtocol.h> | |
| #include <thrift/transport/TTransport.h> | |
| struct SexType { | |
| enum type { | |
| MALE = 1, | |
| FEMALE = 2 | |
| }; | |
| }; | |
| extern const std::map<int, const char*> _SexType_VALUES_TO_NAMES; | |
| typedef struct _User__isset { | |
| _User__isset() : firstname(false), lastname(false), user_id(true), sex(false), active(true), description(false) {} | |
| bool firstname; | |
| bool lastname; | |
| bool user_id; | |
| bool sex; | |
| bool active; | |
| bool description; | |
| } _User__isset; | |
| class User { | |
| public: | |
| static const char* ascii_fingerprint; // = "91A4D70357F54081AD8F263E934234C0"; | |
| static const uint8_t binary_fingerprint[16]; // = {0x91,0xA4,0xD7,0x03,0x57,0xF5,0x40,0x81,0xAD,0x8F,0x26,0x3E,0x93,0x42,0x34,0xC0}; | |
| User() : firstname(), lastname(), user_id(0), sex((SexType::type)0), active(false), description() { | |
| } | |
| virtual ~User() throw() {} | |
| std::string firstname; | |
| std::string lastname; | |
| int32_t user_id; | |
| SexType::type sex; | |
| bool active; | |
| std::string description; | |
| _User__isset __isset; | |
| void __set_firstname(const std::string& val) { | |
| firstname = val; | |
| } | |
| void __set_lastname(const std::string& val) { | |
| lastname = val; | |
| } | |
| void __set_user_id(const int32_t val) { | |
| user_id = val; | |
| } | |
| void __set_sex(const SexType::type val) { | |
| sex = val; | |
| } | |
| void __set_active(const bool val) { | |
| active = val; | |
| } | |
| void __set_description(const std::string& val) { | |
| description = val; | |
| __isset.description = true; | |
| } | |
| bool operator == (const User & rhs) const | |
| { | |
| if (!(firstname == rhs.firstname)) | |
| return false; | |
| if (!(lastname == rhs.lastname)) | |
| return false; | |
| if (!(user_id == rhs.user_id)) | |
| return false; | |
| if (!(sex == rhs.sex)) | |
| return false; | |
| if (!(active == rhs.active)) | |
| return false; | |
| if (__isset.description != rhs.__isset.description) | |
| return false; | |
| else if (__isset.description && !(description == rhs.description)) | |
| return false; | |
| return true; | |
| } | |
| bool operator != (const User &rhs) const { | |
| return !(*this == rhs); | |
| } | |
| bool operator < (const User & ) const; | |
| uint32_t read(::apache::thrift::protocol::TProtocol* iprot); | |
| uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; | |
| }; | |
| void swap(User &a, User &b); | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Autogenerated by Thrift Compiler (0.9.0) | |
| // | |
| // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| // | |
| SexType = { | |
| 'MALE' : 1, | |
| 'FEMALE' : 2 | |
| }; | |
| User = function(args) { | |
| this.firstname = null; | |
| this.lastname = null; | |
| this.user_id = 0; | |
| this.sex = null; | |
| this.active = false; | |
| this.description = null; | |
| if (args) { | |
| if (args.firstname !== undefined) { | |
| this.firstname = args.firstname; | |
| } | |
| if (args.lastname !== undefined) { | |
| this.lastname = args.lastname; | |
| } | |
| if (args.user_id !== undefined) { | |
| this.user_id = args.user_id; | |
| } | |
| if (args.sex !== undefined) { | |
| this.sex = args.sex; | |
| } | |
| if (args.active !== undefined) { | |
| this.active = args.active; | |
| } | |
| if (args.description !== undefined) { | |
| this.description = args.description; | |
| } | |
| } | |
| }; | |
| User.prototype = {}; | |
| User.prototype.read = function(input) { | |
| input.readStructBegin(); | |
| while (true) | |
| { | |
| var ret = input.readFieldBegin(); | |
| var fname = ret.fname; | |
| var ftype = ret.ftype; | |
| var fid = ret.fid; | |
| if (ftype == Thrift.Type.STOP) { | |
| break; | |
| } | |
| switch (fid) | |
| { | |
| case 1: | |
| if (ftype == Thrift.Type.STRING) { | |
| this.firstname = input.readString().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| case 2: | |
| if (ftype == Thrift.Type.STRING) { | |
| this.lastname = input.readString().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| case 3: | |
| if (ftype == Thrift.Type.I32) { | |
| this.user_id = input.readI32().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| case 4: | |
| if (ftype == Thrift.Type.I32) { | |
| this.sex = input.readI32().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| case 5: | |
| if (ftype == Thrift.Type.BOOL) { | |
| this.active = input.readBool().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| case 6: | |
| if (ftype == Thrift.Type.STRING) { | |
| this.description = input.readString().value; | |
| } else { | |
| input.skip(ftype); | |
| } | |
| break; | |
| default: | |
| input.skip(ftype); | |
| } | |
| input.readFieldEnd(); | |
| } | |
| input.readStructEnd(); | |
| return; | |
| }; | |
| User.prototype.write = function(output) { | |
| output.writeStructBegin('User'); | |
| if (this.firstname !== null && this.firstname !== undefined) { | |
| output.writeFieldBegin('firstname', Thrift.Type.STRING, 1); | |
| output.writeString(this.firstname); | |
| output.writeFieldEnd(); | |
| } | |
| if (this.lastname !== null && this.lastname !== undefined) { | |
| output.writeFieldBegin('lastname', Thrift.Type.STRING, 2); | |
| output.writeString(this.lastname); | |
| output.writeFieldEnd(); | |
| } | |
| if (this.user_id !== null && this.user_id !== undefined) { | |
| output.writeFieldBegin('user_id', Thrift.Type.I32, 3); | |
| output.writeI32(this.user_id); | |
| output.writeFieldEnd(); | |
| } | |
| if (this.sex !== null && this.sex !== undefined) { | |
| output.writeFieldBegin('sex', Thrift.Type.I32, 4); | |
| output.writeI32(this.sex); | |
| output.writeFieldEnd(); | |
| } | |
| if (this.active !== null && this.active !== undefined) { | |
| output.writeFieldBegin('active', Thrift.Type.BOOL, 5); | |
| output.writeBool(this.active); | |
| output.writeFieldEnd(); | |
| } | |
| if (this.description !== null && this.description !== undefined) { | |
| output.writeFieldBegin('description', Thrift.Type.STRING, 6); | |
| output.writeString(this.description); | |
| output.writeFieldEnd(); | |
| } | |
| output.writeFieldStop(); | |
| output.writeStructEnd(); | |
| return; | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Autogenerated by Thrift Compiler (0.9.0) | |
| # | |
| # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
| # | |
| require 'thrift' | |
| module SexType | |
| MALE = 1 | |
| FEMALE = 2 | |
| VALUE_MAP = {1 => "MALE", 2 => "FEMALE"} | |
| VALID_VALUES = Set.new([MALE, FEMALE]).freeze | |
| end | |
| class User | |
| include ::Thrift::Struct, ::Thrift::Struct_Union | |
| FIRSTNAME = 1 | |
| LASTNAME = 2 | |
| USER_ID = 3 | |
| SEX = 4 | |
| ACTIVE = 5 | |
| DESCRIPTION = 6 | |
| FIELDS = { | |
| FIRSTNAME => {:type => ::Thrift::Types::STRING, :name => 'firstname'}, | |
| LASTNAME => {:type => ::Thrift::Types::STRING, :name => 'lastname'}, | |
| USER_ID => {:type => ::Thrift::Types::I32, :name => 'user_id', :default => 0}, | |
| SEX => {:type => ::Thrift::Types::I32, :name => 'sex', :enum_class => ::SexType}, | |
| ACTIVE => {:type => ::Thrift::Types::BOOL, :name => 'active', :default => false}, | |
| DESCRIPTION => {:type => ::Thrift::Types::STRING, :name => 'description', :optional => true} | |
| } | |
| def struct_fields; FIELDS; end | |
| def validate | |
| unless @sex.nil? || ::SexType::VALID_VALUES.include?(@sex) | |
| raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field sex!') | |
| end | |
| end | |
| ::Thrift::Struct.generate_accessors self | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment