eletuchy | b8f0d49 | 2007-09-19 01:23:19 +0000 | [diff] [blame] | 1 | /** |
| 2 | * Autogenerated by Thrift |
| 3 | * |
| 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
| 5 | */ |
| 6 | package com.facebook.thrift.reflection.limited; |
| 7 | |
| 8 | import java.util.ArrayList; |
| 9 | import java.util.AbstractMap; |
| 10 | import java.util.HashMap; |
| 11 | import java.util.HashSet; |
| 12 | import com.facebook.thrift.*; |
| 13 | |
| 14 | import com.facebook.thrift.protocol.*; |
| 15 | import com.facebook.thrift.transport.*; |
| 16 | |
| 17 | public class Method implements java.io.Serializable { |
| 18 | public String name; |
| 19 | public ThriftType return_type; |
| 20 | public ArrayList<Argument> arguments; |
| 21 | |
| 22 | public final Isset __isset = new Isset(); |
| 23 | public static final class Isset { |
| 24 | public boolean name = false; |
| 25 | public boolean return_type = false; |
| 26 | public boolean arguments = false; |
| 27 | } |
| 28 | |
| 29 | public Method() { |
| 30 | } |
| 31 | |
| 32 | public Method( |
| 33 | String name, |
| 34 | ThriftType return_type, |
| 35 | ArrayList<Argument> arguments) |
| 36 | { |
| 37 | this(); |
| 38 | this.name = name; |
| 39 | this.__isset.name = true; |
| 40 | this.return_type = return_type; |
| 41 | this.__isset.return_type = true; |
| 42 | this.arguments = arguments; |
| 43 | this.__isset.arguments = true; |
| 44 | } |
| 45 | |
| 46 | public void read(TProtocol iprot) throws TException { |
| 47 | TField field; |
| 48 | iprot.readStructBegin(); |
| 49 | while (true) |
| 50 | { |
| 51 | field = iprot.readFieldBegin(); |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 52 | if (field.type == TType.STOP) { |
eletuchy | b8f0d49 | 2007-09-19 01:23:19 +0000 | [diff] [blame] | 53 | break; |
| 54 | } |
| 55 | switch (field.id) |
| 56 | { |
| 57 | case 1: |
| 58 | if (field.type == TType.STRING) { |
| 59 | this.name = iprot.readString(); |
| 60 | this.__isset.name = true; |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 61 | } else { |
eletuchy | b8f0d49 | 2007-09-19 01:23:19 +0000 | [diff] [blame] | 62 | TProtocolUtil.skip(iprot, field.type); |
| 63 | } |
| 64 | break; |
| 65 | case 2: |
| 66 | if (field.type == TType.STRUCT) { |
| 67 | this.return_type = new ThriftType(); |
| 68 | this.return_type.read(iprot); |
| 69 | this.__isset.return_type = true; |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 70 | } else { |
eletuchy | b8f0d49 | 2007-09-19 01:23:19 +0000 | [diff] [blame] | 71 | TProtocolUtil.skip(iprot, field.type); |
| 72 | } |
| 73 | break; |
| 74 | case 3: |
| 75 | if (field.type == TType.LIST) { |
| 76 | { |
| 77 | TList _list0 = iprot.readListBegin(); |
| 78 | this.arguments = new ArrayList<Argument>(_list0.size); |
| 79 | for (int _i1 = 0; _i1 < _list0.size; ++_i1) |
| 80 | { |
| 81 | Argument _elem2 = new Argument(); |
| 82 | _elem2 = new Argument(); |
| 83 | _elem2.read(iprot); |
| 84 | this.arguments.add(_elem2); |
| 85 | } |
| 86 | iprot.readListEnd(); |
| 87 | } |
| 88 | this.__isset.arguments = true; |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 89 | } else { |
eletuchy | b8f0d49 | 2007-09-19 01:23:19 +0000 | [diff] [blame] | 90 | TProtocolUtil.skip(iprot, field.type); |
| 91 | } |
| 92 | break; |
| 93 | default: |
| 94 | TProtocolUtil.skip(iprot, field.type); |
| 95 | break; |
| 96 | } |
| 97 | iprot.readFieldEnd(); |
| 98 | } |
| 99 | iprot.readStructEnd(); |
| 100 | } |
| 101 | |
| 102 | public void write(TProtocol oprot) throws TException { |
| 103 | TStruct struct = new TStruct("Method"); |
| 104 | oprot.writeStructBegin(struct); |
| 105 | TField field = new TField(); |
| 106 | if (this.name != null) { |
| 107 | field.name = "name"; |
| 108 | field.type = TType.STRING; |
| 109 | field.id = 1; |
| 110 | oprot.writeFieldBegin(field); |
| 111 | oprot.writeString(this.name); |
| 112 | oprot.writeFieldEnd(); |
| 113 | } |
| 114 | if (this.return_type != null) { |
| 115 | field.name = "return_type"; |
| 116 | field.type = TType.STRUCT; |
| 117 | field.id = 2; |
| 118 | oprot.writeFieldBegin(field); |
| 119 | this.return_type.write(oprot); |
| 120 | oprot.writeFieldEnd(); |
| 121 | } |
| 122 | if (this.arguments != null) { |
| 123 | field.name = "arguments"; |
| 124 | field.type = TType.LIST; |
| 125 | field.id = 3; |
| 126 | oprot.writeFieldBegin(field); |
| 127 | { |
| 128 | oprot.writeListBegin(new TList(TType.STRUCT, this.arguments.size())); |
| 129 | for (Argument _iter3 : this.arguments) { |
| 130 | _iter3.write(oprot); |
| 131 | oprot.writeListEnd(); |
| 132 | } |
| 133 | } |
| 134 | oprot.writeFieldEnd(); |
| 135 | } |
| 136 | oprot.writeFieldStop(); |
| 137 | oprot.writeStructEnd(); |
| 138 | } |
| 139 | |
| 140 | public String toString() { |
| 141 | StringBuilder sb = new StringBuilder("Method("); |
| 142 | sb.append("name:"); |
| 143 | sb.append(this.name); |
| 144 | sb.append(",return_type:"); |
| 145 | sb.append(this.return_type.toString()); |
| 146 | sb.append(",arguments:"); |
| 147 | sb.append(this.arguments); |
| 148 | sb.append(")"); |
| 149 | return sb.toString(); |
| 150 | } |
| 151 | |
| 152 | } |
| 153 | |