From: eletuchy Date: Wed, 19 Sep 2007 01:23:19 +0000 (+0000) Subject: [thrift] checking in generated reflection code into java library X-Git-Tag: 0.2.0~1197 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=b8f0d496c16504f43e0d5c9ec6e6090742a4a086;p=common%2Fthrift.git [thrift] checking in generated reflection code into java library Summary: Generated this code using: /usr/local/share/thrift/if/reflection_limited.thrift Reviewed By: dreiss Test Plan: compiled chat_importer (a java FacebookService) against this. Revert Plan: sure Database Impact: Memcache Impact: Other Notes: EImportant: git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665275 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/reflection/limited/Argument.java b/lib/java/src/reflection/limited/Argument.java new file mode 100644 index 00000000..c24e07e3 --- /dev/null +++ b/lib/java/src/reflection/limited/Argument.java @@ -0,0 +1,134 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class Argument implements java.io.Serializable { + public short key; + public String name; + public ThriftType type; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean key = false; + public boolean name = false; + public boolean type = false; + } + + public Argument() { + } + + public Argument( + short key, + String name, + ThriftType type) + { + this(); + this.key = key; + this.__isset.key = true; + this.name = name; + this.__isset.name = true; + this.type = type; + this.__isset.type = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.I16) { + this.key = iprot.readI16(); + this.__isset.key = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.STRING) { + this.name = iprot.readString(); + this.__isset.name = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: + if (field.type == TType.STRUCT) { + this.type = new ThriftType(); + this.type.read(iprot); + this.__isset.type = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("Argument"); + oprot.writeStructBegin(struct); + TField field = new TField(); + field.name = "key"; + field.type = TType.I16; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeI16(this.key); + oprot.writeFieldEnd(); + if (this.name != null) { + field.name = "name"; + field.type = TType.STRING; + field.id = 2; + oprot.writeFieldBegin(field); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + if (this.type != null) { + field.name = "type"; + field.type = TType.STRUCT; + field.id = 3; + oprot.writeFieldBegin(field); + this.type.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("Argument("); + sb.append("key:"); + sb.append(this.key); + sb.append(",name:"); + sb.append(this.name); + sb.append(",type:"); + sb.append(this.type.toString()); + sb.append(")"); + return sb.toString(); + } + +} + diff --git a/lib/java/src/reflection/limited/Constants.java b/lib/java/src/reflection/limited/Constants.java new file mode 100644 index 00000000..669abac5 --- /dev/null +++ b/lib/java/src/reflection/limited/Constants.java @@ -0,0 +1,16 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +public class Constants { + +} diff --git a/lib/java/src/reflection/limited/ContainerType.java b/lib/java/src/reflection/limited/ContainerType.java new file mode 100644 index 00000000..11d38729 --- /dev/null +++ b/lib/java/src/reflection/limited/ContainerType.java @@ -0,0 +1,135 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class ContainerType implements java.io.Serializable { + public int ttype; + public SimpleType subtype1; + public SimpleType subtype2; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean ttype = false; + public boolean subtype1 = false; + public boolean subtype2 = false; + } + + public ContainerType() { + } + + public ContainerType( + int ttype, + SimpleType subtype1, + SimpleType subtype2) + { + this(); + this.ttype = ttype; + this.__isset.ttype = true; + this.subtype1 = subtype1; + this.__isset.subtype1 = true; + this.subtype2 = subtype2; + this.__isset.subtype2 = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.I32) { + this.ttype = iprot.readI32(); + this.__isset.ttype = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.STRUCT) { + this.subtype1 = new SimpleType(); + this.subtype1.read(iprot); + this.__isset.subtype1 = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: + if (field.type == TType.STRUCT) { + this.subtype2 = new SimpleType(); + this.subtype2.read(iprot); + this.__isset.subtype2 = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("ContainerType"); + oprot.writeStructBegin(struct); + TField field = new TField(); + field.name = "ttype"; + field.type = TType.I32; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeI32(this.ttype); + oprot.writeFieldEnd(); + if (this.subtype1 != null) { + field.name = "subtype1"; + field.type = TType.STRUCT; + field.id = 2; + oprot.writeFieldBegin(field); + this.subtype1.write(oprot); + oprot.writeFieldEnd(); + } + if (this.subtype2 != null) { + field.name = "subtype2"; + field.type = TType.STRUCT; + field.id = 3; + oprot.writeFieldBegin(field); + this.subtype2.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("ContainerType("); + sb.append("ttype:"); + sb.append(this.ttype); + sb.append(",subtype1:"); + sb.append(this.subtype1.toString()); + sb.append(",subtype2:"); + sb.append(this.subtype2.toString()); + sb.append(")"); + return sb.toString(); + } + +} + diff --git a/lib/java/src/reflection/limited/Method.java b/lib/java/src/reflection/limited/Method.java new file mode 100644 index 00000000..64ba21d7 --- /dev/null +++ b/lib/java/src/reflection/limited/Method.java @@ -0,0 +1,153 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class Method implements java.io.Serializable { + public String name; + public ThriftType return_type; + public ArrayList arguments; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean name = false; + public boolean return_type = false; + public boolean arguments = false; + } + + public Method() { + } + + public Method( + String name, + ThriftType return_type, + ArrayList arguments) + { + this(); + this.name = name; + this.__isset.name = true; + this.return_type = return_type; + this.__isset.return_type = true; + this.arguments = arguments; + this.__isset.arguments = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.STRING) { + this.name = iprot.readString(); + this.__isset.name = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.STRUCT) { + this.return_type = new ThriftType(); + this.return_type.read(iprot); + this.__isset.return_type = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: + if (field.type == TType.LIST) { + { + TList _list0 = iprot.readListBegin(); + this.arguments = new ArrayList(_list0.size); + for (int _i1 = 0; _i1 < _list0.size; ++_i1) + { + Argument _elem2 = new Argument(); + _elem2 = new Argument(); + _elem2.read(iprot); + this.arguments.add(_elem2); + } + iprot.readListEnd(); + } + this.__isset.arguments = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("Method"); + oprot.writeStructBegin(struct); + TField field = new TField(); + if (this.name != null) { + field.name = "name"; + field.type = TType.STRING; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + if (this.return_type != null) { + field.name = "return_type"; + field.type = TType.STRUCT; + field.id = 2; + oprot.writeFieldBegin(field); + this.return_type.write(oprot); + oprot.writeFieldEnd(); + } + if (this.arguments != null) { + field.name = "arguments"; + field.type = TType.LIST; + field.id = 3; + oprot.writeFieldBegin(field); + { + oprot.writeListBegin(new TList(TType.STRUCT, this.arguments.size())); + for (Argument _iter3 : this.arguments) { + _iter3.write(oprot); + oprot.writeListEnd(); + } + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("Method("); + sb.append("name:"); + sb.append(this.name); + sb.append(",return_type:"); + sb.append(this.return_type.toString()); + sb.append(",arguments:"); + sb.append(this.arguments); + sb.append(")"); + return sb.toString(); + } + +} + diff --git a/lib/java/src/reflection/limited/Service.java b/lib/java/src/reflection/limited/Service.java new file mode 100644 index 00000000..f3a9481c --- /dev/null +++ b/lib/java/src/reflection/limited/Service.java @@ -0,0 +1,150 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class Service implements java.io.Serializable { + public String name; + public ArrayList methods; + public boolean fully_reflected; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean name = false; + public boolean methods = false; + public boolean fully_reflected = false; + } + + public Service() { + } + + public Service( + String name, + ArrayList methods, + boolean fully_reflected) + { + this(); + this.name = name; + this.__isset.name = true; + this.methods = methods; + this.__isset.methods = true; + this.fully_reflected = fully_reflected; + this.__isset.fully_reflected = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.STRING) { + this.name = iprot.readString(); + this.__isset.name = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.LIST) { + { + TList _list4 = iprot.readListBegin(); + this.methods = new ArrayList(_list4.size); + for (int _i5 = 0; _i5 < _list4.size; ++_i5) + { + Method _elem6 = new Method(); + _elem6 = new Method(); + _elem6.read(iprot); + this.methods.add(_elem6); + } + iprot.readListEnd(); + } + this.__isset.methods = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: + if (field.type == TType.BOOL) { + this.fully_reflected = iprot.readBool(); + this.__isset.fully_reflected = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("Service"); + oprot.writeStructBegin(struct); + TField field = new TField(); + if (this.name != null) { + field.name = "name"; + field.type = TType.STRING; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + if (this.methods != null) { + field.name = "methods"; + field.type = TType.LIST; + field.id = 2; + oprot.writeFieldBegin(field); + { + oprot.writeListBegin(new TList(TType.STRUCT, this.methods.size())); + for (Method _iter7 : this.methods) { + _iter7.write(oprot); + oprot.writeListEnd(); + } + } + oprot.writeFieldEnd(); + } + field.name = "fully_reflected"; + field.type = TType.BOOL; + field.id = 3; + oprot.writeFieldBegin(field); + oprot.writeBool(this.fully_reflected); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("Service("); + sb.append("name:"); + sb.append(this.name); + sb.append(",methods:"); + sb.append(this.methods); + sb.append(",fully_reflected:"); + sb.append(this.fully_reflected); + sb.append(")"); + return sb.toString(); + } + +} + diff --git a/lib/java/src/reflection/limited/SimpleType.java b/lib/java/src/reflection/limited/SimpleType.java new file mode 100644 index 00000000..c0feae63 --- /dev/null +++ b/lib/java/src/reflection/limited/SimpleType.java @@ -0,0 +1,110 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class SimpleType implements java.io.Serializable { + public int ttype; + public String name; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean ttype = false; + public boolean name = false; + } + + public SimpleType() { + } + + public SimpleType( + int ttype, + String name) + { + this(); + this.ttype = ttype; + this.__isset.ttype = true; + this.name = name; + this.__isset.name = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.I32) { + this.ttype = iprot.readI32(); + this.__isset.ttype = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.STRING) { + this.name = iprot.readString(); + this.__isset.name = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("SimpleType"); + oprot.writeStructBegin(struct); + TField field = new TField(); + field.name = "ttype"; + field.type = TType.I32; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeI32(this.ttype); + oprot.writeFieldEnd(); + if (this.name != null) { + field.name = "name"; + field.type = TType.STRING; + field.id = 2; + oprot.writeFieldBegin(field); + oprot.writeString(this.name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("SimpleType("); + sb.append("ttype:"); + sb.append(this.ttype); + sb.append(",name:"); + sb.append(this.name); + sb.append(")"); + return sb.toString(); + } + +} + diff --git a/lib/java/src/reflection/limited/TTypeTag.java b/lib/java/src/reflection/limited/TTypeTag.java new file mode 100644 index 00000000..c9095f55 --- /dev/null +++ b/lib/java/src/reflection/limited/TTypeTag.java @@ -0,0 +1,24 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + + +public class TTypeTag { + public static final int T_VOID = 1; + public static final int T_BOOL = 2; + public static final int T_BYTE = 3; + public static final int T_I16 = 6; + public static final int T_I32 = 8; + public static final int T_I64 = 10; + public static final int T_DOUBLE = 4; + public static final int T_STRING = 11; + public static final int T_STRUCT = 12; + public static final int T_MAP = 13; + public static final int T_SET = 14; + public static final int T_LIST = 15; + public static final int T_ENUM = 101; + public static final int T_NOT_REFLECTED = 102; +} diff --git a/lib/java/src/reflection/limited/ThriftType.java b/lib/java/src/reflection/limited/ThriftType.java new file mode 100644 index 00000000..d3bb3eb9 --- /dev/null +++ b/lib/java/src/reflection/limited/ThriftType.java @@ -0,0 +1,135 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +package com.facebook.thrift.reflection.limited; + +import java.util.ArrayList; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.HashSet; +import com.facebook.thrift.*; + +import com.facebook.thrift.protocol.*; +import com.facebook.thrift.transport.*; + +public class ThriftType implements java.io.Serializable { + public boolean is_container; + public SimpleType simple_type; + public ContainerType container_type; + + public final Isset __isset = new Isset(); + public static final class Isset { + public boolean is_container = false; + public boolean simple_type = false; + public boolean container_type = false; + } + + public ThriftType() { + } + + public ThriftType( + boolean is_container, + SimpleType simple_type, + ContainerType container_type) + { + this(); + this.is_container = is_container; + this.__isset.is_container = true; + this.simple_type = simple_type; + this.__isset.simple_type = true; + this.container_type = container_type; + this.__isset.container_type = true; + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) + { + case 1: + if (field.type == TType.BOOL) { + this.is_container = iprot.readBool(); + this.__isset.is_container = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: + if (field.type == TType.STRUCT) { + this.simple_type = new SimpleType(); + this.simple_type.read(iprot); + this.__isset.simple_type = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 3: + if (field.type == TType.STRUCT) { + this.container_type = new ContainerType(); + this.container_type.read(iprot); + this.__isset.container_type = true; + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + } + + public void write(TProtocol oprot) throws TException { + TStruct struct = new TStruct("ThriftType"); + oprot.writeStructBegin(struct); + TField field = new TField(); + field.name = "is_container"; + field.type = TType.BOOL; + field.id = 1; + oprot.writeFieldBegin(field); + oprot.writeBool(this.is_container); + oprot.writeFieldEnd(); + if (this.simple_type != null) { + field.name = "simple_type"; + field.type = TType.STRUCT; + field.id = 2; + oprot.writeFieldBegin(field); + this.simple_type.write(oprot); + oprot.writeFieldEnd(); + } + if (this.container_type != null) { + field.name = "container_type"; + field.type = TType.STRUCT; + field.id = 3; + oprot.writeFieldBegin(field); + this.container_type.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + public String toString() { + StringBuilder sb = new StringBuilder("ThriftType("); + sb.append("is_container:"); + sb.append(this.is_container); + sb.append(",simple_type:"); + sb.append(this.simple_type.toString()); + sb.append(",container_type:"); + sb.append(this.container_type.toString()); + sb.append(")"); + return sb.toString(); + } + +} +