You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2013/01/14 21:30:11 UTC
[5/9] Upgrade thrift version to 0.9.0
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java
index 7d90872..1535653 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterColumn.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -48,6 +58,12 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("value", org.apache.thrift.protocol.TType.I64, (short)2);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CounterColumnStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CounterColumnTupleSchemeFactory());
+ }
+
public ByteBuffer name; // required
public long value; // required
@@ -114,8 +130,7 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
// isset id assignments
private static final int __VALUE_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
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);
@@ -144,8 +159,7 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
* Performs a deep copy on <i>other</i>.
*/
public CounterColumn(CounterColumn other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = org.apache.thrift.TBaseHelper.copyBinary(other.name);
;
@@ -209,16 +223,16 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
}
public void unsetValue() {
- __isset_bit_vector.clear(__VALUE_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALUE_ISSET_ID);
}
/** Returns true if field value is set (has been assigned a value) and false otherwise */
public boolean isSetValue() {
- return __isset_bit_vector.get(__VALUE_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __VALUE_ISSET_ID);
}
public void setValueIsSet(boolean value) {
- __isset_bit_vector.set(__VALUE_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALUE_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
@@ -356,58 +370,11 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // NAME
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.name = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // VALUE
- if (field.type == org.apache.thrift.protocol.TType.I64) {
- this.value = iprot.readI64();
- setValueIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- if (!isSetValue()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' was not found in serialized data! Struct: " + toString());
- }
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeBinary(this.name);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldBegin(VALUE_FIELD_DESC);
- oprot.writeI64(this.value);
- oprot.writeFieldEnd();
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -436,6 +403,7 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
}
// alas, we cannot check 'value' because it's a primitive and you chose the non-beans generator.
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -449,12 +417,103 @@ public class CounterColumn implements org.apache.thrift.TBase<CounterColumn, Cou
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_bit_vector = new BitSet(1);
+ __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 CounterColumnStandardSchemeFactory implements SchemeFactory {
+ public CounterColumnStandardScheme getScheme() {
+ return new CounterColumnStandardScheme();
+ }
+ }
+
+ private static class CounterColumnStandardScheme extends StandardScheme<CounterColumn> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CounterColumn 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: // NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // VALUE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+ struct.value = iprot.readI64();
+ struct.setValueIsSet(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
+ if (!struct.isSetValue()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'value' was not found in serialized data! Struct: " + toString());
+ }
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, CounterColumn struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeBinary(struct.name);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldBegin(VALUE_FIELD_DESC);
+ oprot.writeI64(struct.value);
+ oprot.writeFieldEnd();
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CounterColumnTupleSchemeFactory implements SchemeFactory {
+ public CounterColumnTupleScheme getScheme() {
+ return new CounterColumnTupleScheme();
+ }
+ }
+
+ private static class CounterColumnTupleScheme extends TupleScheme<CounterColumn> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CounterColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBinary(struct.name);
+ oprot.writeI64(struct.value);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CounterColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ struct.value = iprot.readI64();
+ struct.setValueIsSet(true);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java
index ce15984..ea719cc 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CounterSuperColumn.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -48,6 +58,12 @@ public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperC
private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CounterSuperColumnStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CounterSuperColumnTupleSchemeFactory());
+ }
+
public ByteBuffer name; // required
public List<CounterColumn> columns; // required
@@ -113,7 +129,6 @@ public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperC
}
// isset id assignments
-
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);
@@ -373,74 +388,11 @@ public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperC
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // NAME
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.name = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // COLUMNS
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
- this.columns = new ArrayList<CounterColumn>(_list4.size);
- for (int _i5 = 0; _i5 < _list4.size; ++_i5)
- {
- CounterColumn _elem6; // required
- _elem6 = new CounterColumn();
- _elem6.read(iprot);
- this.columns.add(_elem6);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.name != null) {
- oprot.writeFieldBegin(NAME_FIELD_DESC);
- oprot.writeBinary(this.name);
- oprot.writeFieldEnd();
- }
- if (this.columns != null) {
- oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.columns.size()));
- for (CounterColumn _iter7 : this.columns)
- {
- _iter7.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -475,6 +427,7 @@ public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperC
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -493,5 +446,129 @@ public class CounterSuperColumn implements org.apache.thrift.TBase<CounterSuperC
}
}
+ private static class CounterSuperColumnStandardSchemeFactory implements SchemeFactory {
+ public CounterSuperColumnStandardScheme getScheme() {
+ return new CounterSuperColumnStandardScheme();
+ }
+ }
+
+ private static class CounterSuperColumnStandardScheme extends StandardScheme<CounterSuperColumn> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CounterSuperColumn 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: // NAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // COLUMNS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
+ struct.columns = new ArrayList<CounterColumn>(_list8.size);
+ for (int _i9 = 0; _i9 < _list8.size; ++_i9)
+ {
+ CounterColumn _elem10; // required
+ _elem10 = new CounterColumn();
+ _elem10.read(iprot);
+ struct.columns.add(_elem10);
+ }
+ iprot.readListEnd();
+ }
+ struct.setColumnsIsSet(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, CounterSuperColumn struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeBinary(struct.name);
+ oprot.writeFieldEnd();
+ }
+ if (struct.columns != null) {
+ oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
+ for (CounterColumn _iter11 : struct.columns)
+ {
+ _iter11.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CounterSuperColumnTupleSchemeFactory implements SchemeFactory {
+ public CounterSuperColumnTupleScheme getScheme() {
+ return new CounterSuperColumnTupleScheme();
+ }
+ }
+
+ private static class CounterSuperColumnTupleScheme extends TupleScheme<CounterSuperColumn> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CounterSuperColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBinary(struct.name);
+ {
+ oprot.writeI32(struct.columns.size());
+ for (CounterColumn _iter12 : struct.columns)
+ {
+ _iter12.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CounterSuperColumn struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.name = iprot.readBinary();
+ struct.setNameIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.columns = new ArrayList<CounterColumn>(_list13.size);
+ for (int _i14 = 0; _i14 < _list13.size; ++_i14)
+ {
+ CounterColumn _elem15; // required
+ _elem15 = new CounterColumn();
+ _elem15.read(iprot);
+ struct.columns.add(_elem15);
+ }
+ }
+ struct.setColumnsIsSet(true);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java
index f7df6b6..6af8e9e 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlMetadata.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -50,6 +60,12 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
private static final org.apache.thrift.protocol.TField DEFAULT_NAME_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("default_name_type", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField DEFAULT_VALUE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("default_value_type", org.apache.thrift.protocol.TType.STRING, (short)4);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CqlMetadataStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CqlMetadataTupleSchemeFactory());
+ }
+
public Map<ByteBuffer,String> name_types; // required
public Map<ByteBuffer,String> value_types; // required
public String default_name_type; // required
@@ -123,7 +139,6 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
}
// isset id assignments
-
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);
@@ -542,120 +557,11 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // NAME_TYPES
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map73 = iprot.readMapBegin();
- this.name_types = new HashMap<ByteBuffer,String>(2*_map73.size);
- for (int _i74 = 0; _i74 < _map73.size; ++_i74)
- {
- ByteBuffer _key75; // required
- String _val76; // required
- _key75 = iprot.readBinary();
- _val76 = iprot.readString();
- this.name_types.put(_key75, _val76);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // VALUE_TYPES
- if (field.type == org.apache.thrift.protocol.TType.MAP) {
- {
- org.apache.thrift.protocol.TMap _map77 = iprot.readMapBegin();
- this.value_types = new HashMap<ByteBuffer,String>(2*_map77.size);
- for (int _i78 = 0; _i78 < _map77.size; ++_i78)
- {
- ByteBuffer _key79; // required
- String _val80; // required
- _key79 = iprot.readBinary();
- _val80 = iprot.readString();
- this.value_types.put(_key79, _val80);
- }
- iprot.readMapEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // DEFAULT_NAME_TYPE
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.default_name_type = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // DEFAULT_VALUE_TYPE
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.default_value_type = iprot.readString();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.name_types != null) {
- oprot.writeFieldBegin(NAME_TYPES_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.name_types.size()));
- for (Map.Entry<ByteBuffer, String> _iter81 : this.name_types.entrySet())
- {
- oprot.writeBinary(_iter81.getKey());
- oprot.writeString(_iter81.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.value_types != null) {
- oprot.writeFieldBegin(VALUE_TYPES_FIELD_DESC);
- {
- oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, this.value_types.size()));
- for (Map.Entry<ByteBuffer, String> _iter82 : this.value_types.entrySet())
- {
- oprot.writeBinary(_iter82.getKey());
- oprot.writeString(_iter82.getValue());
- }
- oprot.writeMapEnd();
- }
- oprot.writeFieldEnd();
- }
- if (this.default_name_type != null) {
- oprot.writeFieldBegin(DEFAULT_NAME_TYPE_FIELD_DESC);
- oprot.writeString(this.default_name_type);
- oprot.writeFieldEnd();
- }
- if (this.default_value_type != null) {
- oprot.writeFieldBegin(DEFAULT_VALUE_TYPE_FIELD_DESC);
- oprot.writeString(this.default_value_type);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -712,6 +618,7 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
if (default_value_type == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'default_value_type' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -730,5 +637,203 @@ public class CqlMetadata implements org.apache.thrift.TBase<CqlMetadata, CqlMeta
}
}
+ private static class CqlMetadataStandardSchemeFactory implements SchemeFactory {
+ public CqlMetadataStandardScheme getScheme() {
+ return new CqlMetadataStandardScheme();
+ }
+ }
+
+ private static class CqlMetadataStandardScheme extends StandardScheme<CqlMetadata> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CqlMetadata 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: // NAME_TYPES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map146 = iprot.readMapBegin();
+ struct.name_types = new HashMap<ByteBuffer,String>(2*_map146.size);
+ for (int _i147 = 0; _i147 < _map146.size; ++_i147)
+ {
+ ByteBuffer _key148; // required
+ String _val149; // required
+ _key148 = iprot.readBinary();
+ _val149 = iprot.readString();
+ struct.name_types.put(_key148, _val149);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setName_typesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // VALUE_TYPES
+ if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
+ {
+ org.apache.thrift.protocol.TMap _map150 = iprot.readMapBegin();
+ struct.value_types = new HashMap<ByteBuffer,String>(2*_map150.size);
+ for (int _i151 = 0; _i151 < _map150.size; ++_i151)
+ {
+ ByteBuffer _key152; // required
+ String _val153; // required
+ _key152 = iprot.readBinary();
+ _val153 = iprot.readString();
+ struct.value_types.put(_key152, _val153);
+ }
+ iprot.readMapEnd();
+ }
+ struct.setValue_typesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // DEFAULT_NAME_TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.default_name_type = iprot.readString();
+ struct.setDefault_name_typeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // DEFAULT_VALUE_TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.default_value_type = iprot.readString();
+ struct.setDefault_value_typeIsSet(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, CqlMetadata struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.name_types != null) {
+ oprot.writeFieldBegin(NAME_TYPES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.name_types.size()));
+ for (Map.Entry<ByteBuffer, String> _iter154 : struct.name_types.entrySet())
+ {
+ oprot.writeBinary(_iter154.getKey());
+ oprot.writeString(_iter154.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.value_types != null) {
+ oprot.writeFieldBegin(VALUE_TYPES_FIELD_DESC);
+ {
+ oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.value_types.size()));
+ for (Map.Entry<ByteBuffer, String> _iter155 : struct.value_types.entrySet())
+ {
+ oprot.writeBinary(_iter155.getKey());
+ oprot.writeString(_iter155.getValue());
+ }
+ oprot.writeMapEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ if (struct.default_name_type != null) {
+ oprot.writeFieldBegin(DEFAULT_NAME_TYPE_FIELD_DESC);
+ oprot.writeString(struct.default_name_type);
+ oprot.writeFieldEnd();
+ }
+ if (struct.default_value_type != null) {
+ oprot.writeFieldBegin(DEFAULT_VALUE_TYPE_FIELD_DESC);
+ oprot.writeString(struct.default_value_type);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CqlMetadataTupleSchemeFactory implements SchemeFactory {
+ public CqlMetadataTupleScheme getScheme() {
+ return new CqlMetadataTupleScheme();
+ }
+ }
+
+ private static class CqlMetadataTupleScheme extends TupleScheme<CqlMetadata> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CqlMetadata struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ {
+ oprot.writeI32(struct.name_types.size());
+ for (Map.Entry<ByteBuffer, String> _iter156 : struct.name_types.entrySet())
+ {
+ oprot.writeBinary(_iter156.getKey());
+ oprot.writeString(_iter156.getValue());
+ }
+ }
+ {
+ oprot.writeI32(struct.value_types.size());
+ for (Map.Entry<ByteBuffer, String> _iter157 : struct.value_types.entrySet())
+ {
+ oprot.writeBinary(_iter157.getKey());
+ oprot.writeString(_iter157.getValue());
+ }
+ }
+ oprot.writeString(struct.default_name_type);
+ oprot.writeString(struct.default_value_type);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CqlMetadata struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ {
+ org.apache.thrift.protocol.TMap _map158 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.name_types = new HashMap<ByteBuffer,String>(2*_map158.size);
+ for (int _i159 = 0; _i159 < _map158.size; ++_i159)
+ {
+ ByteBuffer _key160; // required
+ String _val161; // required
+ _key160 = iprot.readBinary();
+ _val161 = iprot.readString();
+ struct.name_types.put(_key160, _val161);
+ }
+ }
+ struct.setName_typesIsSet(true);
+ {
+ org.apache.thrift.protocol.TMap _map162 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.value_types = new HashMap<ByteBuffer,String>(2*_map162.size);
+ for (int _i163 = 0; _i163 < _map162.size; ++_i163)
+ {
+ ByteBuffer _key164; // required
+ String _val165; // required
+ _key164 = iprot.readBinary();
+ _val165 = iprot.readString();
+ struct.value_types.put(_key164, _val165);
+ }
+ }
+ struct.setValue_typesIsSet(true);
+ struct.default_name_type = iprot.readString();
+ struct.setDefault_name_typeIsSet(true);
+ struct.default_value_type = iprot.readString();
+ struct.setDefault_value_typeIsSet(true);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java
index 25e5f0f..7d3460c 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlPreparedResult.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -50,10 +60,16 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
private static final org.apache.thrift.protocol.TField VARIABLE_TYPES_FIELD_DESC = new org.apache.thrift.protocol.TField("variable_types", org.apache.thrift.protocol.TType.LIST, (short)3);
private static final org.apache.thrift.protocol.TField VARIABLE_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("variable_names", org.apache.thrift.protocol.TType.LIST, (short)4);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CqlPreparedResultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CqlPreparedResultTupleSchemeFactory());
+ }
+
public int itemId; // required
public int count; // required
- public List<String> variable_types; // required
- public List<String> variable_names; // required
+ public List<String> variable_types; // optional
+ public List<String> variable_names; // 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 {
@@ -125,8 +141,8 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
// isset id assignments
private static final int __ITEMID_ISSET_ID = 0;
private static final int __COUNT_ISSET_ID = 1;
- private BitSet __isset_bit_vector = new BitSet(2);
-
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.VARIABLE_TYPES,_Fields.VARIABLE_NAMES};
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);
@@ -162,8 +178,7 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
* Performs a deep copy on <i>other</i>.
*/
public CqlPreparedResult(CqlPreparedResult other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
this.itemId = other.itemId;
this.count = other.count;
if (other.isSetVariable_types()) {
@@ -207,16 +222,16 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
}
public void unsetItemId() {
- __isset_bit_vector.clear(__ITEMID_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ITEMID_ISSET_ID);
}
/** Returns true if field itemId is set (has been assigned a value) and false otherwise */
public boolean isSetItemId() {
- return __isset_bit_vector.get(__ITEMID_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __ITEMID_ISSET_ID);
}
public void setItemIdIsSet(boolean value) {
- __isset_bit_vector.set(__ITEMID_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ITEMID_ISSET_ID, value);
}
public int getCount() {
@@ -230,16 +245,16 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
}
public void unsetCount() {
- __isset_bit_vector.clear(__COUNT_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
- return __isset_bit_vector.get(__COUNT_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
- __isset_bit_vector.set(__COUNT_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COUNT_ISSET_ID, value);
}
public int getVariable_typesSize() {
@@ -529,122 +544,11 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // ITEM_ID
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.itemId = iprot.readI32();
- setItemIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // COUNT
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.count = iprot.readI32();
- setCountIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // VARIABLE_TYPES
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list87 = iprot.readListBegin();
- this.variable_types = new ArrayList<String>(_list87.size);
- for (int _i88 = 0; _i88 < _list87.size; ++_i88)
- {
- String _elem89; // required
- _elem89 = iprot.readString();
- this.variable_types.add(_elem89);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // VARIABLE_NAMES
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list90 = iprot.readListBegin();
- this.variable_names = new ArrayList<String>(_list90.size);
- for (int _i91 = 0; _i91 < _list90.size; ++_i91)
- {
- String _elem92; // required
- _elem92 = iprot.readString();
- this.variable_names.add(_elem92);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- if (!isSetItemId()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'itemId' was not found in serialized data! Struct: " + toString());
- }
- if (!isSetCount()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
- }
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
- oprot.writeI32(this.itemId);
- oprot.writeFieldEnd();
- oprot.writeFieldBegin(COUNT_FIELD_DESC);
- oprot.writeI32(this.count);
- oprot.writeFieldEnd();
- if (this.variable_types != null) {
- if (isSetVariable_types()) {
- oprot.writeFieldBegin(VARIABLE_TYPES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.variable_types.size()));
- for (String _iter93 : this.variable_types)
- {
- oprot.writeString(_iter93);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (this.variable_names != null) {
- if (isSetVariable_names()) {
- oprot.writeFieldBegin(VARIABLE_NAMES_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.variable_names.size()));
- for (String _iter94 : this.variable_names)
- {
- oprot.writeString(_iter94);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -687,6 +591,7 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
// check for required fields
// alas, we cannot check 'itemId' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'count' because it's a primitive and you chose the non-beans generator.
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -700,12 +605,221 @@ public class CqlPreparedResult implements org.apache.thrift.TBase<CqlPreparedRes
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_bit_vector = new BitSet(1);
+ __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 CqlPreparedResultStandardSchemeFactory implements SchemeFactory {
+ public CqlPreparedResultStandardScheme getScheme() {
+ return new CqlPreparedResultStandardScheme();
+ }
+ }
+
+ private static class CqlPreparedResultStandardScheme extends StandardScheme<CqlPreparedResult> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CqlPreparedResult 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: // ITEM_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.itemId = iprot.readI32();
+ struct.setItemIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // COUNT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.count = iprot.readI32();
+ struct.setCountIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // VARIABLE_TYPES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list174 = iprot.readListBegin();
+ struct.variable_types = new ArrayList<String>(_list174.size);
+ for (int _i175 = 0; _i175 < _list174.size; ++_i175)
+ {
+ String _elem176; // required
+ _elem176 = iprot.readString();
+ struct.variable_types.add(_elem176);
+ }
+ iprot.readListEnd();
+ }
+ struct.setVariable_typesIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // VARIABLE_NAMES
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list177 = iprot.readListBegin();
+ struct.variable_names = new ArrayList<String>(_list177.size);
+ for (int _i178 = 0; _i178 < _list177.size; ++_i178)
+ {
+ String _elem179; // required
+ _elem179 = iprot.readString();
+ struct.variable_names.add(_elem179);
+ }
+ iprot.readListEnd();
+ }
+ struct.setVariable_namesIsSet(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
+ if (!struct.isSetItemId()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'itemId' was not found in serialized data! Struct: " + toString());
+ }
+ if (!struct.isSetCount()) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'count' was not found in serialized data! Struct: " + toString());
+ }
+ struct.validate();
+ }
+
+ public void write(org.apache.thrift.protocol.TProtocol oprot, CqlPreparedResult struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ oprot.writeFieldBegin(ITEM_ID_FIELD_DESC);
+ oprot.writeI32(struct.itemId);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(COUNT_FIELD_DESC);
+ oprot.writeI32(struct.count);
+ oprot.writeFieldEnd();
+ if (struct.variable_types != null) {
+ if (struct.isSetVariable_types()) {
+ oprot.writeFieldBegin(VARIABLE_TYPES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.variable_types.size()));
+ for (String _iter180 : struct.variable_types)
+ {
+ oprot.writeString(_iter180);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.variable_names != null) {
+ if (struct.isSetVariable_names()) {
+ oprot.writeFieldBegin(VARIABLE_NAMES_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.variable_names.size()));
+ for (String _iter181 : struct.variable_names)
+ {
+ oprot.writeString(_iter181);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CqlPreparedResultTupleSchemeFactory implements SchemeFactory {
+ public CqlPreparedResultTupleScheme getScheme() {
+ return new CqlPreparedResultTupleScheme();
+ }
+ }
+
+ private static class CqlPreparedResultTupleScheme extends TupleScheme<CqlPreparedResult> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CqlPreparedResult struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.itemId);
+ oprot.writeI32(struct.count);
+ BitSet optionals = new BitSet();
+ if (struct.isSetVariable_types()) {
+ optionals.set(0);
+ }
+ if (struct.isSetVariable_names()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetVariable_types()) {
+ {
+ oprot.writeI32(struct.variable_types.size());
+ for (String _iter182 : struct.variable_types)
+ {
+ oprot.writeString(_iter182);
+ }
+ }
+ }
+ if (struct.isSetVariable_names()) {
+ {
+ oprot.writeI32(struct.variable_names.size());
+ for (String _iter183 : struct.variable_names)
+ {
+ oprot.writeString(_iter183);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CqlPreparedResult struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.itemId = iprot.readI32();
+ struct.setItemIdIsSet(true);
+ struct.count = iprot.readI32();
+ struct.setCountIsSet(true);
+ BitSet incoming = iprot.readBitSet(2);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list184 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.variable_types = new ArrayList<String>(_list184.size);
+ for (int _i185 = 0; _i185 < _list184.size; ++_i185)
+ {
+ String _elem186; // required
+ _elem186 = iprot.readString();
+ struct.variable_types.add(_elem186);
+ }
+ }
+ struct.setVariable_typesIsSet(true);
+ }
+ if (incoming.get(1)) {
+ {
+ org.apache.thrift.protocol.TList _list187 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+ struct.variable_names = new ArrayList<String>(_list187.size);
+ for (int _i188 = 0; _i188 < _list187.size; ++_i188)
+ {
+ String _elem189; // required
+ _elem189 = iprot.readString();
+ struct.variable_names.add(_elem189);
+ }
+ }
+ struct.setVariable_namesIsSet(true);
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
index 7c0129f..53afbaa 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResult.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -50,14 +60,20 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
private static final org.apache.thrift.protocol.TField NUM_FIELD_DESC = new org.apache.thrift.protocol.TField("num", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("schema", org.apache.thrift.protocol.TType.STRUCT, (short)4);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CqlResultStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CqlResultTupleSchemeFactory());
+ }
+
/**
*
* @see CqlResultType
*/
public CqlResultType type; // required
- public List<CqlRow> rows; // required
- public int num; // required
- public CqlMetadata schema; // required
+ public List<CqlRow> rows; // optional
+ public int num; // optional
+ public CqlMetadata schema; // 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 {
@@ -132,8 +148,8 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
// isset id assignments
private static final int __NUM_ISSET_ID = 0;
- private BitSet __isset_bit_vector = new BitSet(1);
-
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.ROWS,_Fields.NUM,_Fields.SCHEMA};
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);
@@ -164,8 +180,7 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
* Performs a deep copy on <i>other</i>.
*/
public CqlResult(CqlResult other) {
- __isset_bit_vector.clear();
- __isset_bit_vector.or(other.__isset_bit_vector);
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetType()) {
this.type = other.type;
}
@@ -277,16 +292,16 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
}
public void unsetNum() {
- __isset_bit_vector.clear(__NUM_ISSET_ID);
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUM_ISSET_ID);
}
/** Returns true if field num is set (has been assigned a value) and false otherwise */
public boolean isSetNum() {
- return __isset_bit_vector.get(__NUM_ISSET_ID);
+ return EncodingUtils.testBit(__isset_bitfield, __NUM_ISSET_ID);
}
public void setNumIsSet(boolean value) {
- __isset_bit_vector.set(__NUM_ISSET_ID, value);
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUM_ISSET_ID, value);
}
public CqlMetadata getSchema() {
@@ -522,104 +537,11 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // TYPE
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.type = CqlResultType.findByValue(iprot.readI32());
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // ROWS
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list83 = iprot.readListBegin();
- this.rows = new ArrayList<CqlRow>(_list83.size);
- for (int _i84 = 0; _i84 < _list83.size; ++_i84)
- {
- CqlRow _elem85; // required
- _elem85 = new CqlRow();
- _elem85.read(iprot);
- this.rows.add(_elem85);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 3: // NUM
- if (field.type == org.apache.thrift.protocol.TType.I32) {
- this.num = iprot.readI32();
- setNumIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 4: // SCHEMA
- if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
- this.schema = new CqlMetadata();
- this.schema.read(iprot);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.type != null) {
- oprot.writeFieldBegin(TYPE_FIELD_DESC);
- oprot.writeI32(this.type.getValue());
- oprot.writeFieldEnd();
- }
- if (this.rows != null) {
- if (isSetRows()) {
- oprot.writeFieldBegin(ROWS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.rows.size()));
- for (CqlRow _iter86 : this.rows)
- {
- _iter86.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- }
- if (isSetNum()) {
- oprot.writeFieldBegin(NUM_FIELD_DESC);
- oprot.writeI32(this.num);
- oprot.writeFieldEnd();
- }
- if (this.schema != null) {
- if (isSetSchema()) {
- oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
- this.schema.write(oprot);
- oprot.writeFieldEnd();
- }
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -669,6 +591,10 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
if (type == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
+ if (schema != null) {
+ schema.validate();
+ }
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -682,12 +608,198 @@ public class CqlResult implements org.apache.thrift.TBase<CqlResult, CqlResult._
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_bit_vector = new BitSet(1);
+ __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 CqlResultStandardSchemeFactory implements SchemeFactory {
+ public CqlResultStandardScheme getScheme() {
+ return new CqlResultStandardScheme();
+ }
+ }
+
+ private static class CqlResultStandardScheme extends StandardScheme<CqlResult> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CqlResult 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: // TYPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.type = CqlResultType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // ROWS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list166 = iprot.readListBegin();
+ struct.rows = new ArrayList<CqlRow>(_list166.size);
+ for (int _i167 = 0; _i167 < _list166.size; ++_i167)
+ {
+ CqlRow _elem168; // required
+ _elem168 = new CqlRow();
+ _elem168.read(iprot);
+ struct.rows.add(_elem168);
+ }
+ iprot.readListEnd();
+ }
+ struct.setRowsIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // NUM
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.num = iprot.readI32();
+ struct.setNumIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // SCHEMA
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.schema = new CqlMetadata();
+ struct.schema.read(iprot);
+ struct.setSchemaIsSet(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, CqlResult struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.type != null) {
+ oprot.writeFieldBegin(TYPE_FIELD_DESC);
+ oprot.writeI32(struct.type.getValue());
+ oprot.writeFieldEnd();
+ }
+ if (struct.rows != null) {
+ if (struct.isSetRows()) {
+ oprot.writeFieldBegin(ROWS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.rows.size()));
+ for (CqlRow _iter169 : struct.rows)
+ {
+ _iter169.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ }
+ if (struct.isSetNum()) {
+ oprot.writeFieldBegin(NUM_FIELD_DESC);
+ oprot.writeI32(struct.num);
+ oprot.writeFieldEnd();
+ }
+ if (struct.schema != null) {
+ if (struct.isSetSchema()) {
+ oprot.writeFieldBegin(SCHEMA_FIELD_DESC);
+ struct.schema.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CqlResultTupleSchemeFactory implements SchemeFactory {
+ public CqlResultTupleScheme getScheme() {
+ return new CqlResultTupleScheme();
+ }
+ }
+
+ private static class CqlResultTupleScheme extends TupleScheme<CqlResult> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CqlResult struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeI32(struct.type.getValue());
+ BitSet optionals = new BitSet();
+ if (struct.isSetRows()) {
+ optionals.set(0);
+ }
+ if (struct.isSetNum()) {
+ optionals.set(1);
+ }
+ if (struct.isSetSchema()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
+ if (struct.isSetRows()) {
+ {
+ oprot.writeI32(struct.rows.size());
+ for (CqlRow _iter170 : struct.rows)
+ {
+ _iter170.write(oprot);
+ }
+ }
+ }
+ if (struct.isSetNum()) {
+ oprot.writeI32(struct.num);
+ }
+ if (struct.isSetSchema()) {
+ struct.schema.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CqlResult struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.type = CqlResultType.findByValue(iprot.readI32());
+ struct.setTypeIsSet(true);
+ BitSet incoming = iprot.readBitSet(3);
+ if (incoming.get(0)) {
+ {
+ org.apache.thrift.protocol.TList _list171 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.rows = new ArrayList<CqlRow>(_list171.size);
+ for (int _i172 = 0; _i172 < _list171.size; ++_i172)
+ {
+ CqlRow _elem173; // required
+ _elem173 = new CqlRow();
+ _elem173.read(iprot);
+ struct.rows.add(_elem173);
+ }
+ }
+ struct.setRowsIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.num = iprot.readI32();
+ struct.setNumIsSet(true);
+ }
+ if (incoming.get(2)) {
+ struct.schema = new CqlMetadata();
+ struct.schema.read(iprot);
+ struct.setSchemaIsSet(true);
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java
index 09c37b2..524d67b 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlResultType.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b153d456/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
----------------------------------------------------------------------
diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
index df7ec85..8fce2e1 100644
--- a/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
+++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/CqlRow.java
@@ -1,7 +1,8 @@
/**
- * Autogenerated by Thrift Compiler (0.7.0)
+ * Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
*/
package org.apache.cassandra.thrift;
/*
@@ -27,6 +28,15 @@ package org.apache.cassandra.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
+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;
@@ -51,6 +61,12 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
+ private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+ static {
+ schemes.put(StandardScheme.class, new CqlRowStandardSchemeFactory());
+ schemes.put(TupleScheme.class, new CqlRowTupleSchemeFactory());
+ }
+
public ByteBuffer key; // required
public List<Column> columns; // required
@@ -116,7 +132,6 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
}
// isset id assignments
-
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);
@@ -376,74 +391,11 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField field;
- iprot.readStructBegin();
- while (true)
- {
- field = iprot.readFieldBegin();
- if (field.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (field.id) {
- case 1: // KEY
- if (field.type == org.apache.thrift.protocol.TType.STRING) {
- this.key = iprot.readBinary();
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- case 2: // COLUMNS
- if (field.type == org.apache.thrift.protocol.TType.LIST) {
- {
- org.apache.thrift.protocol.TList _list69 = iprot.readListBegin();
- this.columns = new ArrayList<Column>(_list69.size);
- for (int _i70 = 0; _i70 < _list69.size; ++_i70)
- {
- Column _elem71; // required
- _elem71 = new Column();
- _elem71.read(iprot);
- this.columns.add(_elem71);
- }
- iprot.readListEnd();
- }
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- validate();
+ schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (this.key != null) {
- oprot.writeFieldBegin(KEY_FIELD_DESC);
- oprot.writeBinary(this.key);
- oprot.writeFieldEnd();
- }
- if (this.columns != null) {
- oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
- {
- oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.columns.size()));
- for (Column _iter72 : this.columns)
- {
- _iter72.write(oprot);
- }
- oprot.writeListEnd();
- }
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
+ schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
@@ -478,6 +430,7 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
if (columns == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'columns' was not present! Struct: " + toString());
}
+ // check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -496,5 +449,129 @@ public class CqlRow implements org.apache.thrift.TBase<CqlRow, CqlRow._Fields>,
}
}
+ private static class CqlRowStandardSchemeFactory implements SchemeFactory {
+ public CqlRowStandardScheme getScheme() {
+ return new CqlRowStandardScheme();
+ }
+ }
+
+ private static class CqlRowStandardScheme extends StandardScheme<CqlRow> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, CqlRow 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: // KEY
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.key = iprot.readBinary();
+ struct.setKeyIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 2: // COLUMNS
+ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+ {
+ org.apache.thrift.protocol.TList _list138 = iprot.readListBegin();
+ struct.columns = new ArrayList<Column>(_list138.size);
+ for (int _i139 = 0; _i139 < _list138.size; ++_i139)
+ {
+ Column _elem140; // required
+ _elem140 = new Column();
+ _elem140.read(iprot);
+ struct.columns.add(_elem140);
+ }
+ iprot.readListEnd();
+ }
+ struct.setColumnsIsSet(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, CqlRow struct) throws org.apache.thrift.TException {
+ struct.validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (struct.key != null) {
+ oprot.writeFieldBegin(KEY_FIELD_DESC);
+ oprot.writeBinary(struct.key);
+ oprot.writeFieldEnd();
+ }
+ if (struct.columns != null) {
+ oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
+ {
+ oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
+ for (Column _iter141 : struct.columns)
+ {
+ _iter141.write(oprot);
+ }
+ oprot.writeListEnd();
+ }
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class CqlRowTupleSchemeFactory implements SchemeFactory {
+ public CqlRowTupleScheme getScheme() {
+ return new CqlRowTupleScheme();
+ }
+ }
+
+ private static class CqlRowTupleScheme extends TupleScheme<CqlRow> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, CqlRow struct) throws org.apache.thrift.TException {
+ TTupleProtocol oprot = (TTupleProtocol) prot;
+ oprot.writeBinary(struct.key);
+ {
+ oprot.writeI32(struct.columns.size());
+ for (Column _iter142 : struct.columns)
+ {
+ _iter142.write(oprot);
+ }
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, CqlRow struct) throws org.apache.thrift.TException {
+ TTupleProtocol iprot = (TTupleProtocol) prot;
+ struct.key = iprot.readBinary();
+ struct.setKeyIsSet(true);
+ {
+ org.apache.thrift.protocol.TList _list143 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+ struct.columns = new ArrayList<Column>(_list143.size);
+ for (int _i144 = 0; _i144 < _list143.size; ++_i144)
+ {
+ Column _elem145; // required
+ _elem145 = new Column();
+ _elem145.read(iprot);
+ struct.columns.add(_elem145);
+ }
+ }
+ struct.setColumnsIsSet(true);
+ }
+ }
+
}