You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/10/22 05:23:31 UTC
svn commit: r1026200 [3/11] - in /cassandra/trunk: ./ interface/
interface/thrift/gen-java/org/apache/cassandra/thrift/
src/java/org/apache/cassandra/auth/ src/java/org/apache/cassandra/avro/
src/java/org/apache/cassandra/cli/ src/java/org/apache/cassa...
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -355,9 +356,44 @@ public class CfDef implements TBase<CfDe
return new CfDef(this);
}
- @Deprecated
- public CfDef clone() {
- return new CfDef(this);
+ @Override
+ public void clear() {
+ this.keyspace = null;
+ this.name = null;
+ this.column_type = "Standard";
+
+ this.comparator_type = "BytesType";
+
+ this.subcomparator_type = null;
+ this.comment = null;
+ this.row_cache_size = (double)0;
+
+ this.preload_row_cache = false;
+
+ this.key_cache_size = (double)200000;
+
+ this.read_repair_chance = 1;
+
+ this.column_metadata = null;
+ setGc_grace_secondsIsSet(false);
+ this.gc_grace_seconds = 0;
+ this.default_validation_class = null;
+ setIdIsSet(false);
+ this.id = 0;
+ setMin_compaction_thresholdIsSet(false);
+ this.min_compaction_threshold = 0;
+ setMax_compaction_thresholdIsSet(false);
+ this.max_compaction_threshold = 0;
+ setRow_cache_save_period_in_secondsIsSet(false);
+ this.row_cache_save_period_in_seconds = 0;
+ setKey_cache_save_period_in_secondsIsSet(false);
+ this.key_cache_save_period_in_seconds = 0;
+ setMemtable_flush_after_minsIsSet(false);
+ this.memtable_flush_after_mins = 0;
+ setMemtable_throughput_in_mbIsSet(false);
+ this.memtable_throughput_in_mb = 0;
+ setMemtable_operations_in_millionsIsSet(false);
+ this.memtable_operations_in_millions = 0.0;
}
public String getKeyspace() {
@@ -1039,10 +1075,6 @@ public class CfDef implements TBase<CfDe
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case KEYSPACE:
@@ -1112,12 +1144,12 @@ public class CfDef implements TBase<CfDe
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case KEYSPACE:
return isSetKeyspace();
@@ -1165,10 +1197,6 @@ public class CfDef implements TBase<CfDe
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -1498,7 +1526,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetKeyspace()) { lastComparison = TBaseHelper.compareTo(this.keyspace, typedOther.keyspace);
+ if (isSetKeyspace()) {
+ lastComparison = TBaseHelper.compareTo(this.keyspace, typedOther.keyspace);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1507,7 +1536,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
+ if (isSetName()) {
+ lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1516,7 +1546,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn_type()) { lastComparison = TBaseHelper.compareTo(this.column_type, typedOther.column_type);
+ if (isSetColumn_type()) {
+ lastComparison = TBaseHelper.compareTo(this.column_type, typedOther.column_type);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1525,7 +1556,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetComparator_type()) { lastComparison = TBaseHelper.compareTo(this.comparator_type, typedOther.comparator_type);
+ if (isSetComparator_type()) {
+ lastComparison = TBaseHelper.compareTo(this.comparator_type, typedOther.comparator_type);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1534,7 +1566,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSubcomparator_type()) { lastComparison = TBaseHelper.compareTo(this.subcomparator_type, typedOther.subcomparator_type);
+ if (isSetSubcomparator_type()) {
+ lastComparison = TBaseHelper.compareTo(this.subcomparator_type, typedOther.subcomparator_type);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1543,7 +1576,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetComment()) { lastComparison = TBaseHelper.compareTo(this.comment, typedOther.comment);
+ if (isSetComment()) {
+ lastComparison = TBaseHelper.compareTo(this.comment, typedOther.comment);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1552,7 +1586,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetRow_cache_size()) { lastComparison = TBaseHelper.compareTo(this.row_cache_size, typedOther.row_cache_size);
+ if (isSetRow_cache_size()) {
+ lastComparison = TBaseHelper.compareTo(this.row_cache_size, typedOther.row_cache_size);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1561,7 +1596,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetPreload_row_cache()) { lastComparison = TBaseHelper.compareTo(this.preload_row_cache, typedOther.preload_row_cache);
+ if (isSetPreload_row_cache()) {
+ lastComparison = TBaseHelper.compareTo(this.preload_row_cache, typedOther.preload_row_cache);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1570,7 +1606,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetKey_cache_size()) { lastComparison = TBaseHelper.compareTo(this.key_cache_size, typedOther.key_cache_size);
+ if (isSetKey_cache_size()) {
+ lastComparison = TBaseHelper.compareTo(this.key_cache_size, typedOther.key_cache_size);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1579,7 +1616,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetRead_repair_chance()) { lastComparison = TBaseHelper.compareTo(this.read_repair_chance, typedOther.read_repair_chance);
+ if (isSetRead_repair_chance()) {
+ lastComparison = TBaseHelper.compareTo(this.read_repair_chance, typedOther.read_repair_chance);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1588,7 +1626,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn_metadata()) { lastComparison = TBaseHelper.compareTo(this.column_metadata, typedOther.column_metadata);
+ if (isSetColumn_metadata()) {
+ lastComparison = TBaseHelper.compareTo(this.column_metadata, typedOther.column_metadata);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1597,7 +1636,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetGc_grace_seconds()) { lastComparison = TBaseHelper.compareTo(this.gc_grace_seconds, typedOther.gc_grace_seconds);
+ if (isSetGc_grace_seconds()) {
+ lastComparison = TBaseHelper.compareTo(this.gc_grace_seconds, typedOther.gc_grace_seconds);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1606,7 +1646,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetDefault_validation_class()) { lastComparison = TBaseHelper.compareTo(this.default_validation_class, typedOther.default_validation_class);
+ if (isSetDefault_validation_class()) {
+ lastComparison = TBaseHelper.compareTo(this.default_validation_class, typedOther.default_validation_class);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1615,7 +1656,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetId()) { lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
+ if (isSetId()) {
+ lastComparison = TBaseHelper.compareTo(this.id, typedOther.id);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1624,7 +1666,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetMin_compaction_threshold()) { lastComparison = TBaseHelper.compareTo(this.min_compaction_threshold, typedOther.min_compaction_threshold);
+ if (isSetMin_compaction_threshold()) {
+ lastComparison = TBaseHelper.compareTo(this.min_compaction_threshold, typedOther.min_compaction_threshold);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1633,7 +1676,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetMax_compaction_threshold()) { lastComparison = TBaseHelper.compareTo(this.max_compaction_threshold, typedOther.max_compaction_threshold);
+ if (isSetMax_compaction_threshold()) {
+ lastComparison = TBaseHelper.compareTo(this.max_compaction_threshold, typedOther.max_compaction_threshold);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1642,7 +1686,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetRow_cache_save_period_in_seconds()) { lastComparison = TBaseHelper.compareTo(this.row_cache_save_period_in_seconds, typedOther.row_cache_save_period_in_seconds);
+ if (isSetRow_cache_save_period_in_seconds()) {
+ lastComparison = TBaseHelper.compareTo(this.row_cache_save_period_in_seconds, typedOther.row_cache_save_period_in_seconds);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1651,7 +1696,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetKey_cache_save_period_in_seconds()) { lastComparison = TBaseHelper.compareTo(this.key_cache_save_period_in_seconds, typedOther.key_cache_save_period_in_seconds);
+ if (isSetKey_cache_save_period_in_seconds()) {
+ lastComparison = TBaseHelper.compareTo(this.key_cache_save_period_in_seconds, typedOther.key_cache_save_period_in_seconds);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1660,7 +1706,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetMemtable_flush_after_mins()) { lastComparison = TBaseHelper.compareTo(this.memtable_flush_after_mins, typedOther.memtable_flush_after_mins);
+ if (isSetMemtable_flush_after_mins()) {
+ lastComparison = TBaseHelper.compareTo(this.memtable_flush_after_mins, typedOther.memtable_flush_after_mins);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1669,7 +1716,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetMemtable_throughput_in_mb()) { lastComparison = TBaseHelper.compareTo(this.memtable_throughput_in_mb, typedOther.memtable_throughput_in_mb);
+ if (isSetMemtable_throughput_in_mb()) {
+ lastComparison = TBaseHelper.compareTo(this.memtable_throughput_in_mb, typedOther.memtable_throughput_in_mb);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1678,7 +1726,8 @@ public class CfDef implements TBase<CfDe
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetMemtable_operations_in_millions()) { lastComparison = TBaseHelper.compareTo(this.memtable_operations_in_millions, typedOther.memtable_operations_in_millions);
+ if (isSetMemtable_operations_in_millions()) {
+ lastComparison = TBaseHelper.compareTo(this.memtable_operations_in_millions, typedOther.memtable_operations_in_millions);
if (lastComparison != 0) {
return lastComparison;
}
@@ -1686,6 +1735,10 @@ public class CfDef implements TBase<CfDe
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,8 +63,8 @@ public class Column implements TBase<Col
private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)3);
private static final TField TTL_FIELD_DESC = new TField("ttl", TType.I32, (short)4);
- public byte[] name;
- public byte[] value;
+ public ByteBuffer name;
+ public ByteBuffer value;
public long timestamp;
public int ttl;
@@ -158,8 +159,8 @@ public class Column implements TBase<Col
}
public Column(
- byte[] name,
- byte[] value,
+ ByteBuffer name,
+ ByteBuffer value,
long timestamp)
{
this();
@@ -176,12 +177,12 @@ public class Column implements TBase<Col
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetName()) {
- this.name = new byte[other.name.length];
- System.arraycopy(other.name, 0, name, 0, other.name.length);
+ this.name = TBaseHelper.copyBinary(other.name);
+;
}
if (other.isSetValue()) {
- this.value = new byte[other.value.length];
- System.arraycopy(other.value, 0, value, 0, other.value.length);
+ this.value = TBaseHelper.copyBinary(other.value);
+;
}
this.timestamp = other.timestamp;
this.ttl = other.ttl;
@@ -191,16 +192,31 @@ public class Column implements TBase<Col
return new Column(this);
}
- @Deprecated
- public Column clone() {
- return new Column(this);
+ @Override
+ public void clear() {
+ this.name = null;
+ this.value = null;
+ setTimestampIsSet(false);
+ this.timestamp = 0;
+ setTtlIsSet(false);
+ this.ttl = 0;
}
public byte[] getName() {
- return this.name;
+ setName(TBaseHelper.rightSize(name));
+ return name.array();
+ }
+
+ public ByteBuffer BufferForName() {
+ return name;
}
public Column setName(byte[] name) {
+ setName(ByteBuffer.wrap(name));
+ return this;
+ }
+
+ public Column setName(ByteBuffer name) {
this.name = name;
return this;
}
@@ -221,10 +237,20 @@ public class Column implements TBase<Col
}
public byte[] getValue() {
- return this.value;
+ setValue(TBaseHelper.rightSize(value));
+ return value.array();
+ }
+
+ public ByteBuffer BufferForValue() {
+ return value;
}
public Column setValue(byte[] value) {
+ setValue(ByteBuffer.wrap(value));
+ return this;
+ }
+
+ public Column setValue(ByteBuffer value) {
this.value = value;
return this;
}
@@ -296,7 +322,7 @@ public class Column implements TBase<Col
if (value == null) {
unsetName();
} else {
- setName((byte[])value);
+ setName((ByteBuffer)value);
}
break;
@@ -304,7 +330,7 @@ public class Column implements TBase<Col
if (value == null) {
unsetValue();
} else {
- setValue((byte[])value);
+ setValue((ByteBuffer)value);
}
break;
@@ -327,10 +353,6 @@ public class Column implements TBase<Col
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
@@ -349,12 +371,12 @@ public class Column implements TBase<Col
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case NAME:
return isSetName();
@@ -368,10 +390,6 @@ public class Column implements TBase<Col
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -390,7 +408,7 @@ public class Column implements TBase<Col
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
- if (!java.util.Arrays.equals(this.name, that.name))
+ if (!this.name.equals(that.name))
return false;
}
@@ -399,7 +417,7 @@ public class Column implements TBase<Col
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
- if (!java.util.Arrays.equals(this.value, that.value))
+ if (!this.value.equals(that.value))
return false;
}
@@ -463,7 +481,8 @@ public class Column implements TBase<Col
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
+ if (isSetName()) {
+ lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
if (lastComparison != 0) {
return lastComparison;
}
@@ -472,7 +491,8 @@ public class Column implements TBase<Col
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetValue()) { lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
+ if (isSetValue()) {
+ lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
if (lastComparison != 0) {
return lastComparison;
}
@@ -481,7 +501,8 @@ public class Column implements TBase<Col
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetTimestamp()) { lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
+ if (isSetTimestamp()) {
+ lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
@@ -490,7 +511,8 @@ public class Column implements TBase<Col
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetTtl()) { lastComparison = TBaseHelper.compareTo(this.ttl, typedOther.ttl);
+ if (isSetTtl()) {
+ lastComparison = TBaseHelper.compareTo(this.ttl, typedOther.ttl);
if (lastComparison != 0) {
return lastComparison;
}
@@ -498,6 +520,10 @@ public class Column implements TBase<Col
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -587,12 +613,7 @@ public class Column implements TBase<Col
if (this.name == null) {
sb.append("null");
} else {
- int __name_size = Math.min(this.name.length, 128);
- for (int i = 0; i < __name_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
- }
- if (this.name.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
@@ -600,12 +621,7 @@ public class Column implements TBase<Col
if (this.value == null) {
sb.append("null");
} else {
- int __value_size = Math.min(this.value.length, 128);
- for (int i = 0; i < __value_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
- }
- if (this.value.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.value, sb);
}
first = false;
if (!first) sb.append(", ");
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnDef.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +56,7 @@ public class ColumnDef implements TBase<
private static final TField INDEX_TYPE_FIELD_DESC = new TField("index_type", TType.I32, (short)3);
private static final TField INDEX_NAME_FIELD_DESC = new TField("index_name", TType.STRING, (short)4);
- public byte[] name;
+ public ByteBuffer name;
public String validation_class;
/**
*
@@ -156,7 +157,7 @@ public class ColumnDef implements TBase<
}
public ColumnDef(
- byte[] name,
+ ByteBuffer name,
String validation_class)
{
this();
@@ -169,8 +170,8 @@ public class ColumnDef implements TBase<
*/
public ColumnDef(ColumnDef other) {
if (other.isSetName()) {
- this.name = new byte[other.name.length];
- System.arraycopy(other.name, 0, name, 0, other.name.length);
+ this.name = TBaseHelper.copyBinary(other.name);
+;
}
if (other.isSetValidation_class()) {
this.validation_class = other.validation_class;
@@ -187,16 +188,29 @@ public class ColumnDef implements TBase<
return new ColumnDef(this);
}
- @Deprecated
- public ColumnDef clone() {
- return new ColumnDef(this);
+ @Override
+ public void clear() {
+ this.name = null;
+ this.validation_class = null;
+ this.index_type = null;
+ this.index_name = null;
}
public byte[] getName() {
- return this.name;
+ setName(TBaseHelper.rightSize(name));
+ return name.array();
+ }
+
+ public ByteBuffer BufferForName() {
+ return name;
}
public ColumnDef setName(byte[] name) {
+ setName(ByteBuffer.wrap(name));
+ return this;
+ }
+
+ public ColumnDef setName(ByteBuffer name) {
this.name = name;
return this;
}
@@ -302,7 +316,7 @@ public class ColumnDef implements TBase<
if (value == null) {
unsetName();
} else {
- setName((byte[])value);
+ setName((ByteBuffer)value);
}
break;
@@ -333,10 +347,6 @@ public class ColumnDef implements TBase<
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
@@ -355,12 +365,12 @@ public class ColumnDef implements TBase<
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case NAME:
return isSetName();
@@ -374,10 +384,6 @@ public class ColumnDef implements TBase<
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -396,7 +402,7 @@ public class ColumnDef implements TBase<
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
- if (!java.util.Arrays.equals(this.name, that.name))
+ if (!this.name.equals(that.name))
return false;
}
@@ -469,7 +475,8 @@ public class ColumnDef implements TBase<
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetName()) { lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
+ if (isSetName()) {
+ lastComparison = TBaseHelper.compareTo(this.name, typedOther.name);
if (lastComparison != 0) {
return lastComparison;
}
@@ -478,7 +485,8 @@ public class ColumnDef implements TBase<
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetValidation_class()) { lastComparison = TBaseHelper.compareTo(this.validation_class, typedOther.validation_class);
+ if (isSetValidation_class()) {
+ lastComparison = TBaseHelper.compareTo(this.validation_class, typedOther.validation_class);
if (lastComparison != 0) {
return lastComparison;
}
@@ -487,7 +495,8 @@ public class ColumnDef implements TBase<
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetIndex_type()) { lastComparison = TBaseHelper.compareTo(this.index_type, typedOther.index_type);
+ if (isSetIndex_type()) {
+ lastComparison = TBaseHelper.compareTo(this.index_type, typedOther.index_type);
if (lastComparison != 0) {
return lastComparison;
}
@@ -496,7 +505,8 @@ public class ColumnDef implements TBase<
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetIndex_name()) { lastComparison = TBaseHelper.compareTo(this.index_name, typedOther.index_name);
+ if (isSetIndex_name()) {
+ lastComparison = TBaseHelper.compareTo(this.index_name, typedOther.index_name);
if (lastComparison != 0) {
return lastComparison;
}
@@ -504,6 +514,10 @@ public class ColumnDef implements TBase<
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -594,12 +608,7 @@ public class ColumnDef implements TBase<
if (this.name == null) {
sb.append("null");
} else {
- int __name_size = Math.min(this.name.length, 128);
- for (int i = 0; i < __name_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.name[i]).length() > 1 ? Integer.toHexString(this.name[i]).substring(Integer.toHexString(this.name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.name[i]).toUpperCase());
- }
- if (this.name.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.name, sb);
}
first = false;
if (!first) sb.append(", ");
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnOrSuperColumn.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -159,9 +160,10 @@ public class ColumnOrSuperColumn impleme
return new ColumnOrSuperColumn(this);
}
- @Deprecated
- public ColumnOrSuperColumn clone() {
- return new ColumnOrSuperColumn(this);
+ @Override
+ public void clear() {
+ this.column = null;
+ this.super_column = null;
}
public Column getColumn() {
@@ -233,10 +235,6 @@ public class ColumnOrSuperColumn impleme
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN:
@@ -249,12 +247,12 @@ public class ColumnOrSuperColumn impleme
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case COLUMN:
return isSetColumn();
@@ -264,10 +262,6 @@ public class ColumnOrSuperColumn impleme
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -331,7 +325,8 @@ public class ColumnOrSuperColumn impleme
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn()) { lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
+ if (isSetColumn()) {
+ lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -340,7 +335,8 @@ public class ColumnOrSuperColumn impleme
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
+ if (isSetSuper_column()) {
+ lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -348,6 +344,10 @@ public class ColumnOrSuperColumn impleme
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnParent.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +61,7 @@ public class ColumnParent implements TBa
private static final TField SUPER_COLUMN_FIELD_DESC = new TField("super_column", TType.STRING, (short)4);
public String column_family;
- public byte[] super_column;
+ public ByteBuffer super_column;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
@@ -154,8 +155,8 @@ public class ColumnParent implements TBa
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = new byte[other.super_column.length];
- System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
+ this.super_column = TBaseHelper.copyBinary(other.super_column);
+;
}
}
@@ -163,9 +164,10 @@ public class ColumnParent implements TBa
return new ColumnParent(this);
}
- @Deprecated
- public ColumnParent clone() {
- return new ColumnParent(this);
+ @Override
+ public void clear() {
+ this.column_family = null;
+ this.super_column = null;
}
public String getColumn_family() {
@@ -193,10 +195,20 @@ public class ColumnParent implements TBa
}
public byte[] getSuper_column() {
- return this.super_column;
+ setSuper_column(TBaseHelper.rightSize(super_column));
+ return super_column.array();
+ }
+
+ public ByteBuffer BufferForSuper_column() {
+ return super_column;
}
public ColumnParent setSuper_column(byte[] super_column) {
+ setSuper_column(ByteBuffer.wrap(super_column));
+ return this;
+ }
+
+ public ColumnParent setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
@@ -230,17 +242,13 @@ public class ColumnParent implements TBa
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((byte[])value);
+ setSuper_column((ByteBuffer)value);
}
break;
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_FAMILY:
@@ -253,12 +261,12 @@ public class ColumnParent implements TBa
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case COLUMN_FAMILY:
return isSetColumn_family();
@@ -268,10 +276,6 @@ public class ColumnParent implements TBa
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -299,7 +303,7 @@ public class ColumnParent implements TBa
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!java.util.Arrays.equals(this.super_column, that.super_column))
+ if (!this.super_column.equals(that.super_column))
return false;
}
@@ -335,7 +339,8 @@ public class ColumnParent implements TBa
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn_family()) { lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
+ if (isSetColumn_family()) {
+ lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
if (lastComparison != 0) {
return lastComparison;
}
@@ -344,7 +349,8 @@ public class ColumnParent implements TBa
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
+ if (isSetSuper_column()) {
+ lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -352,6 +358,10 @@ public class ColumnParent implements TBa
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -425,12 +435,7 @@ public class ColumnParent implements TBa
if (this.super_column == null) {
sb.append("null");
} else {
- int __super_column_size = Math.min(this.super_column.length, 128);
- for (int i = 0; i < __super_column_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
- }
- if (this.super_column.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnPath.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnPath.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnPath.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/ColumnPath.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,8 +66,8 @@ public class ColumnPath implements TBase
private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRING, (short)5);
public String column_family;
- public byte[] super_column;
- public byte[] column;
+ public ByteBuffer super_column;
+ public ByteBuffer column;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
@@ -165,12 +166,12 @@ public class ColumnPath implements TBase
this.column_family = other.column_family;
}
if (other.isSetSuper_column()) {
- this.super_column = new byte[other.super_column.length];
- System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
+ this.super_column = TBaseHelper.copyBinary(other.super_column);
+;
}
if (other.isSetColumn()) {
- this.column = new byte[other.column.length];
- System.arraycopy(other.column, 0, column, 0, other.column.length);
+ this.column = TBaseHelper.copyBinary(other.column);
+;
}
}
@@ -178,9 +179,11 @@ public class ColumnPath implements TBase
return new ColumnPath(this);
}
- @Deprecated
- public ColumnPath clone() {
- return new ColumnPath(this);
+ @Override
+ public void clear() {
+ this.column_family = null;
+ this.super_column = null;
+ this.column = null;
}
public String getColumn_family() {
@@ -208,10 +211,20 @@ public class ColumnPath implements TBase
}
public byte[] getSuper_column() {
- return this.super_column;
+ setSuper_column(TBaseHelper.rightSize(super_column));
+ return super_column.array();
+ }
+
+ public ByteBuffer BufferForSuper_column() {
+ return super_column;
}
public ColumnPath setSuper_column(byte[] super_column) {
+ setSuper_column(ByteBuffer.wrap(super_column));
+ return this;
+ }
+
+ public ColumnPath setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
@@ -232,10 +245,20 @@ public class ColumnPath implements TBase
}
public byte[] getColumn() {
- return this.column;
+ setColumn(TBaseHelper.rightSize(column));
+ return column.array();
+ }
+
+ public ByteBuffer BufferForColumn() {
+ return column;
}
public ColumnPath setColumn(byte[] column) {
+ setColumn(ByteBuffer.wrap(column));
+ return this;
+ }
+
+ public ColumnPath setColumn(ByteBuffer column) {
this.column = column;
return this;
}
@@ -269,7 +292,7 @@ public class ColumnPath implements TBase
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((byte[])value);
+ setSuper_column((ByteBuffer)value);
}
break;
@@ -277,17 +300,13 @@ public class ColumnPath implements TBase
if (value == null) {
unsetColumn();
} else {
- setColumn((byte[])value);
+ setColumn((ByteBuffer)value);
}
break;
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_FAMILY:
@@ -303,12 +322,12 @@ public class ColumnPath implements TBase
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case COLUMN_FAMILY:
return isSetColumn_family();
@@ -320,10 +339,6 @@ public class ColumnPath implements TBase
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -351,7 +366,7 @@ public class ColumnPath implements TBase
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!java.util.Arrays.equals(this.super_column, that.super_column))
+ if (!this.super_column.equals(that.super_column))
return false;
}
@@ -360,7 +375,7 @@ public class ColumnPath implements TBase
if (this_present_column || that_present_column) {
if (!(this_present_column && that_present_column))
return false;
- if (!java.util.Arrays.equals(this.column, that.column))
+ if (!this.column.equals(that.column))
return false;
}
@@ -401,7 +416,8 @@ public class ColumnPath implements TBase
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn_family()) { lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
+ if (isSetColumn_family()) {
+ lastComparison = TBaseHelper.compareTo(this.column_family, typedOther.column_family);
if (lastComparison != 0) {
return lastComparison;
}
@@ -410,7 +426,8 @@ public class ColumnPath implements TBase
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
+ if (isSetSuper_column()) {
+ lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -419,7 +436,8 @@ public class ColumnPath implements TBase
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn()) { lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
+ if (isSetColumn()) {
+ lastComparison = TBaseHelper.compareTo(this.column, typedOther.column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -427,6 +445,10 @@ public class ColumnPath implements TBase
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -514,12 +536,7 @@ public class ColumnPath implements TBase
if (this.super_column == null) {
sb.append("null");
} else {
- int __super_column_size = Math.min(this.super_column.length, 128);
- for (int i = 0; i < __super_column_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
- }
- if (this.super_column.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
@@ -529,12 +546,7 @@ public class ColumnPath implements TBase
if (this.column == null) {
sb.append("null");
} else {
- int __column_size = Math.min(this.column.length, 128);
- for (int i = 0; i < __column_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.column[i]).length() > 1 ? Integer.toHexString(this.column[i]).substring(Integer.toHexString(this.column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column[i]).toUpperCase());
- }
- if (this.column.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.column, sb);
}
first = false;
}
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Deletion.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Deletion.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Deletion.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Deletion.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +56,7 @@ public class Deletion implements TBase<D
private static final TField PREDICATE_FIELD_DESC = new TField("predicate", TType.STRUCT, (short)3);
public long timestamp;
- public byte[] super_column;
+ public ByteBuffer super_column;
public SlicePredicate predicate;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -158,8 +159,8 @@ public class Deletion implements TBase<D
__isset_bit_vector.or(other.__isset_bit_vector);
this.timestamp = other.timestamp;
if (other.isSetSuper_column()) {
- this.super_column = new byte[other.super_column.length];
- System.arraycopy(other.super_column, 0, super_column, 0, other.super_column.length);
+ this.super_column = TBaseHelper.copyBinary(other.super_column);
+;
}
if (other.isSetPredicate()) {
this.predicate = new SlicePredicate(other.predicate);
@@ -170,9 +171,12 @@ public class Deletion implements TBase<D
return new Deletion(this);
}
- @Deprecated
- public Deletion clone() {
- return new Deletion(this);
+ @Override
+ public void clear() {
+ setTimestampIsSet(false);
+ this.timestamp = 0;
+ this.super_column = null;
+ this.predicate = null;
}
public long getTimestamp() {
@@ -199,10 +203,20 @@ public class Deletion implements TBase<D
}
public byte[] getSuper_column() {
- return this.super_column;
+ setSuper_column(TBaseHelper.rightSize(super_column));
+ return super_column.array();
+ }
+
+ public ByteBuffer BufferForSuper_column() {
+ return super_column;
}
public Deletion setSuper_column(byte[] super_column) {
+ setSuper_column(ByteBuffer.wrap(super_column));
+ return this;
+ }
+
+ public Deletion setSuper_column(ByteBuffer super_column) {
this.super_column = super_column;
return this;
}
@@ -260,7 +274,7 @@ public class Deletion implements TBase<D
if (value == null) {
unsetSuper_column();
} else {
- setSuper_column((byte[])value);
+ setSuper_column((ByteBuffer)value);
}
break;
@@ -275,10 +289,6 @@ public class Deletion implements TBase<D
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case TIMESTAMP:
@@ -294,12 +304,12 @@ public class Deletion implements TBase<D
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case TIMESTAMP:
return isSetTimestamp();
@@ -311,10 +321,6 @@ public class Deletion implements TBase<D
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -342,7 +348,7 @@ public class Deletion implements TBase<D
if (this_present_super_column || that_present_super_column) {
if (!(this_present_super_column && that_present_super_column))
return false;
- if (!java.util.Arrays.equals(this.super_column, that.super_column))
+ if (!this.super_column.equals(that.super_column))
return false;
}
@@ -392,7 +398,8 @@ public class Deletion implements TBase<D
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetTimestamp()) { lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
+ if (isSetTimestamp()) {
+ lastComparison = TBaseHelper.compareTo(this.timestamp, typedOther.timestamp);
if (lastComparison != 0) {
return lastComparison;
}
@@ -401,7 +408,8 @@ public class Deletion implements TBase<D
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetSuper_column()) { lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
+ if (isSetSuper_column()) {
+ lastComparison = TBaseHelper.compareTo(this.super_column, typedOther.super_column);
if (lastComparison != 0) {
return lastComparison;
}
@@ -410,7 +418,8 @@ public class Deletion implements TBase<D
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetPredicate()) { lastComparison = TBaseHelper.compareTo(this.predicate, typedOther.predicate);
+ if (isSetPredicate()) {
+ lastComparison = TBaseHelper.compareTo(this.predicate, typedOther.predicate);
if (lastComparison != 0) {
return lastComparison;
}
@@ -418,6 +427,10 @@ public class Deletion implements TBase<D
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -504,12 +517,7 @@ public class Deletion implements TBase<D
if (this.super_column == null) {
sb.append("null");
} else {
- int __super_column_size = Math.min(this.super_column.length, 128);
- for (int i = 0; i < __super_column_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.super_column[i]).length() > 1 ? Integer.toHexString(this.super_column[i]).substring(Integer.toHexString(this.super_column[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.super_column[i]).toUpperCase());
- }
- if (this.super_column.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.super_column, sb);
}
first = false;
}
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexClause.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexClause.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexClause.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexClause.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +56,7 @@ public class IndexClause implements TBas
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)3);
public List<IndexExpression> expressions;
- public byte[] start_key;
+ public ByteBuffer start_key;
public int count;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -147,7 +148,7 @@ public class IndexClause implements TBas
public IndexClause(
List<IndexExpression> expressions,
- byte[] start_key,
+ ByteBuffer start_key,
int count)
{
this();
@@ -171,8 +172,8 @@ public class IndexClause implements TBas
this.expressions = __this__expressions;
}
if (other.isSetStart_key()) {
- this.start_key = new byte[other.start_key.length];
- System.arraycopy(other.start_key, 0, start_key, 0, other.start_key.length);
+ this.start_key = TBaseHelper.copyBinary(other.start_key);
+;
}
this.count = other.count;
}
@@ -181,9 +182,12 @@ public class IndexClause implements TBas
return new IndexClause(this);
}
- @Deprecated
- public IndexClause clone() {
- return new IndexClause(this);
+ @Override
+ public void clear() {
+ this.expressions = null;
+ this.start_key = null;
+ this.count = 100;
+
}
public int getExpressionsSize() {
@@ -226,10 +230,20 @@ public class IndexClause implements TBas
}
public byte[] getStart_key() {
- return this.start_key;
+ setStart_key(TBaseHelper.rightSize(start_key));
+ return start_key.array();
+ }
+
+ public ByteBuffer BufferForStart_key() {
+ return start_key;
}
public IndexClause setStart_key(byte[] start_key) {
+ setStart_key(ByteBuffer.wrap(start_key));
+ return this;
+ }
+
+ public IndexClause setStart_key(ByteBuffer start_key) {
this.start_key = start_key;
return this;
}
@@ -286,7 +300,7 @@ public class IndexClause implements TBas
if (value == null) {
unsetStart_key();
} else {
- setStart_key((byte[])value);
+ setStart_key((ByteBuffer)value);
}
break;
@@ -301,10 +315,6 @@ public class IndexClause implements TBas
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case EXPRESSIONS:
@@ -320,12 +330,12 @@ public class IndexClause implements TBas
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case EXPRESSIONS:
return isSetExpressions();
@@ -337,10 +347,6 @@ public class IndexClause implements TBas
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -368,7 +374,7 @@ public class IndexClause implements TBas
if (this_present_start_key || that_present_start_key) {
if (!(this_present_start_key && that_present_start_key))
return false;
- if (!java.util.Arrays.equals(this.start_key, that.start_key))
+ if (!this.start_key.equals(that.start_key))
return false;
}
@@ -418,7 +424,8 @@ public class IndexClause implements TBas
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetExpressions()) { lastComparison = TBaseHelper.compareTo(this.expressions, typedOther.expressions);
+ if (isSetExpressions()) {
+ lastComparison = TBaseHelper.compareTo(this.expressions, typedOther.expressions);
if (lastComparison != 0) {
return lastComparison;
}
@@ -427,7 +434,8 @@ public class IndexClause implements TBas
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetStart_key()) { lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
+ if (isSetStart_key()) {
+ lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
if (lastComparison != 0) {
return lastComparison;
}
@@ -436,7 +444,8 @@ public class IndexClause implements TBas
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
+ if (isSetCount()) {
+ lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
if (lastComparison != 0) {
return lastComparison;
}
@@ -444,6 +453,10 @@ public class IndexClause implements TBas
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -546,12 +559,7 @@ public class IndexClause implements TBas
if (this.start_key == null) {
sb.append("null");
} else {
- int __start_key_size = Math.min(this.start_key.length, 128);
- for (int i = 0; i < __start_key_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.start_key[i]).length() > 1 ? Integer.toHexString(this.start_key[i]).substring(Integer.toHexString(this.start_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start_key[i]).toUpperCase());
- }
- if (this.start_key.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.start_key, sb);
}
first = false;
if (!first) sb.append(", ");
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexExpression.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexExpression.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexExpression.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/IndexExpression.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,13 +55,13 @@ public class IndexExpression implements
private static final TField OP_FIELD_DESC = new TField("op", TType.I32, (short)2);
private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
- public byte[] column_name;
+ public ByteBuffer column_name;
/**
*
* @see IndexOperator
*/
public IndexOperator op;
- public byte[] value;
+ public ByteBuffer value;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
@@ -149,9 +150,9 @@ public class IndexExpression implements
}
public IndexExpression(
- byte[] column_name,
+ ByteBuffer column_name,
IndexOperator op,
- byte[] value)
+ ByteBuffer value)
{
this();
this.column_name = column_name;
@@ -164,15 +165,15 @@ public class IndexExpression implements
*/
public IndexExpression(IndexExpression other) {
if (other.isSetColumn_name()) {
- this.column_name = new byte[other.column_name.length];
- System.arraycopy(other.column_name, 0, column_name, 0, other.column_name.length);
+ this.column_name = TBaseHelper.copyBinary(other.column_name);
+;
}
if (other.isSetOp()) {
this.op = other.op;
}
if (other.isSetValue()) {
- this.value = new byte[other.value.length];
- System.arraycopy(other.value, 0, value, 0, other.value.length);
+ this.value = TBaseHelper.copyBinary(other.value);
+;
}
}
@@ -180,16 +181,28 @@ public class IndexExpression implements
return new IndexExpression(this);
}
- @Deprecated
- public IndexExpression clone() {
- return new IndexExpression(this);
+ @Override
+ public void clear() {
+ this.column_name = null;
+ this.op = null;
+ this.value = null;
}
public byte[] getColumn_name() {
- return this.column_name;
+ setColumn_name(TBaseHelper.rightSize(column_name));
+ return column_name.array();
+ }
+
+ public ByteBuffer BufferForColumn_name() {
+ return column_name;
}
public IndexExpression setColumn_name(byte[] column_name) {
+ setColumn_name(ByteBuffer.wrap(column_name));
+ return this;
+ }
+
+ public IndexExpression setColumn_name(ByteBuffer column_name) {
this.column_name = column_name;
return this;
}
@@ -242,10 +255,20 @@ public class IndexExpression implements
}
public byte[] getValue() {
- return this.value;
+ setValue(TBaseHelper.rightSize(value));
+ return value.array();
+ }
+
+ public ByteBuffer BufferForValue() {
+ return value;
}
public IndexExpression setValue(byte[] value) {
+ setValue(ByteBuffer.wrap(value));
+ return this;
+ }
+
+ public IndexExpression setValue(ByteBuffer value) {
this.value = value;
return this;
}
@@ -271,7 +294,7 @@ public class IndexExpression implements
if (value == null) {
unsetColumn_name();
} else {
- setColumn_name((byte[])value);
+ setColumn_name((ByteBuffer)value);
}
break;
@@ -287,17 +310,13 @@ public class IndexExpression implements
if (value == null) {
unsetValue();
} else {
- setValue((byte[])value);
+ setValue((ByteBuffer)value);
}
break;
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_NAME:
@@ -313,12 +332,12 @@ public class IndexExpression implements
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case COLUMN_NAME:
return isSetColumn_name();
@@ -330,10 +349,6 @@ public class IndexExpression implements
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -352,7 +367,7 @@ public class IndexExpression implements
if (this_present_column_name || that_present_column_name) {
if (!(this_present_column_name && that_present_column_name))
return false;
- if (!java.util.Arrays.equals(this.column_name, that.column_name))
+ if (!this.column_name.equals(that.column_name))
return false;
}
@@ -370,7 +385,7 @@ public class IndexExpression implements
if (this_present_value || that_present_value) {
if (!(this_present_value && that_present_value))
return false;
- if (!java.util.Arrays.equals(this.value, that.value))
+ if (!this.value.equals(that.value))
return false;
}
@@ -411,7 +426,8 @@ public class IndexExpression implements
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetColumn_name()) { lastComparison = TBaseHelper.compareTo(this.column_name, typedOther.column_name);
+ if (isSetColumn_name()) {
+ lastComparison = TBaseHelper.compareTo(this.column_name, typedOther.column_name);
if (lastComparison != 0) {
return lastComparison;
}
@@ -420,7 +436,8 @@ public class IndexExpression implements
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetOp()) { lastComparison = TBaseHelper.compareTo(this.op, typedOther.op);
+ if (isSetOp()) {
+ lastComparison = TBaseHelper.compareTo(this.op, typedOther.op);
if (lastComparison != 0) {
return lastComparison;
}
@@ -429,7 +446,8 @@ public class IndexExpression implements
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetValue()) { lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
+ if (isSetValue()) {
+ lastComparison = TBaseHelper.compareTo(this.value, typedOther.value);
if (lastComparison != 0) {
return lastComparison;
}
@@ -437,6 +455,10 @@ public class IndexExpression implements
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -511,12 +533,7 @@ public class IndexExpression implements
if (this.column_name == null) {
sb.append("null");
} else {
- int __column_name_size = Math.min(this.column_name.length, 128);
- for (int i = 0; i < __column_name_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.column_name[i]).length() > 1 ? Integer.toHexString(this.column_name[i]).substring(Integer.toHexString(this.column_name[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.column_name[i]).toUpperCase());
- }
- if (this.column_name.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.column_name, sb);
}
first = false;
if (!first) sb.append(", ");
@@ -532,12 +549,7 @@ public class IndexExpression implements
if (this.value == null) {
sb.append("null");
} else {
- int __value_size = Math.min(this.value.length, 128);
- for (int i = 0; i < __value_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.value[i]).length() > 1 ? Integer.toHexString(this.value[i]).substring(Integer.toHexString(this.value[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.value[i]).toUpperCase());
- }
- if (this.value.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.value, sb);
}
first = false;
sb.append(")");
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -150,9 +151,9 @@ public class InvalidRequestException ext
return new InvalidRequestException(this);
}
- @Deprecated
- public InvalidRequestException clone() {
- return new InvalidRequestException(this);
+ @Override
+ public void clear() {
+ this.why = null;
}
public String getWhy() {
@@ -192,10 +193,6 @@ public class InvalidRequestException ext
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case WHY:
@@ -205,12 +202,12 @@ public class InvalidRequestException ext
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case WHY:
return isSetWhy();
@@ -218,10 +215,6 @@ public class InvalidRequestException ext
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -271,7 +264,8 @@ public class InvalidRequestException ext
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetWhy()) { lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
+ if (isSetWhy()) {
+ lastComparison = TBaseHelper.compareTo(this.why, typedOther.why);
if (lastComparison != 0) {
return lastComparison;
}
@@ -279,6 +273,10 @@ public class InvalidRequestException ext
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyCount.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyCount.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyCount.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyCount.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,7 +54,7 @@ public class KeyCount implements TBase<K
private static final TField KEY_FIELD_DESC = new TField("key", TType.STRING, (short)1);
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)2);
- public byte[] key;
+ public ByteBuffer key;
public int count;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -136,7 +137,7 @@ public class KeyCount implements TBase<K
}
public KeyCount(
- byte[] key,
+ ByteBuffer key,
int count)
{
this();
@@ -152,8 +153,8 @@ public class KeyCount implements TBase<K
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetKey()) {
- this.key = new byte[other.key.length];
- System.arraycopy(other.key, 0, key, 0, other.key.length);
+ this.key = TBaseHelper.copyBinary(other.key);
+;
}
this.count = other.count;
}
@@ -162,16 +163,28 @@ public class KeyCount implements TBase<K
return new KeyCount(this);
}
- @Deprecated
- public KeyCount clone() {
- return new KeyCount(this);
+ @Override
+ public void clear() {
+ this.key = null;
+ setCountIsSet(false);
+ this.count = 0;
}
public byte[] getKey() {
- return this.key;
+ setKey(TBaseHelper.rightSize(key));
+ return key.array();
+ }
+
+ public ByteBuffer BufferForKey() {
+ return key;
}
public KeyCount setKey(byte[] key) {
+ setKey(ByteBuffer.wrap(key));
+ return this;
+ }
+
+ public KeyCount setKey(ByteBuffer key) {
this.key = key;
return this;
}
@@ -220,7 +233,7 @@ public class KeyCount implements TBase<K
if (value == null) {
unsetKey();
} else {
- setKey((byte[])value);
+ setKey((ByteBuffer)value);
}
break;
@@ -235,10 +248,6 @@ public class KeyCount implements TBase<K
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case KEY:
@@ -251,12 +260,12 @@ public class KeyCount implements TBase<K
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case KEY:
return isSetKey();
@@ -266,10 +275,6 @@ public class KeyCount implements TBase<K
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -288,7 +293,7 @@ public class KeyCount implements TBase<K
if (this_present_key || that_present_key) {
if (!(this_present_key && that_present_key))
return false;
- if (!java.util.Arrays.equals(this.key, that.key))
+ if (!this.key.equals(that.key))
return false;
}
@@ -333,7 +338,8 @@ public class KeyCount implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetKey()) { lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
+ if (isSetKey()) {
+ lastComparison = TBaseHelper.compareTo(this.key, typedOther.key);
if (lastComparison != 0) {
return lastComparison;
}
@@ -342,7 +348,8 @@ public class KeyCount implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
+ if (isSetCount()) {
+ lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
if (lastComparison != 0) {
return lastComparison;
}
@@ -350,6 +357,10 @@ public class KeyCount implements TBase<K
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -414,12 +425,7 @@ public class KeyCount implements TBase<K
if (this.key == null) {
sb.append("null");
} else {
- int __key_size = Math.min(this.key.length, 128);
- for (int i = 0; i < __key_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.key[i]).length() > 1 ? Integer.toHexString(this.key[i]).substring(Integer.toHexString(this.key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.key[i]).toUpperCase());
- }
- if (this.key.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.key, sb);
}
first = false;
if (!first) sb.append(", ");
Modified: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyRange.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyRange.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyRange.java (original)
+++ cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/KeyRange.java Fri Oct 22 03:23:26 2010
@@ -37,6 +37,7 @@ import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,8 +65,8 @@ public class KeyRange implements TBase<K
private static final TField END_TOKEN_FIELD_DESC = new TField("end_token", TType.STRING, (short)4);
private static final TField COUNT_FIELD_DESC = new TField("count", TType.I32, (short)5);
- public byte[] start_key;
- public byte[] end_key;
+ public ByteBuffer start_key;
+ public ByteBuffer end_key;
public String start_token;
public String end_token;
public int count;
@@ -181,12 +182,12 @@ public class KeyRange implements TBase<K
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetStart_key()) {
- this.start_key = new byte[other.start_key.length];
- System.arraycopy(other.start_key, 0, start_key, 0, other.start_key.length);
+ this.start_key = TBaseHelper.copyBinary(other.start_key);
+;
}
if (other.isSetEnd_key()) {
- this.end_key = new byte[other.end_key.length];
- System.arraycopy(other.end_key, 0, end_key, 0, other.end_key.length);
+ this.end_key = TBaseHelper.copyBinary(other.end_key);
+;
}
if (other.isSetStart_token()) {
this.start_token = other.start_token;
@@ -201,16 +202,31 @@ public class KeyRange implements TBase<K
return new KeyRange(this);
}
- @Deprecated
- public KeyRange clone() {
- return new KeyRange(this);
+ @Override
+ public void clear() {
+ this.start_key = null;
+ this.end_key = null;
+ this.start_token = null;
+ this.end_token = null;
+ this.count = 100;
+
}
public byte[] getStart_key() {
- return this.start_key;
+ setStart_key(TBaseHelper.rightSize(start_key));
+ return start_key.array();
+ }
+
+ public ByteBuffer BufferForStart_key() {
+ return start_key;
}
public KeyRange setStart_key(byte[] start_key) {
+ setStart_key(ByteBuffer.wrap(start_key));
+ return this;
+ }
+
+ public KeyRange setStart_key(ByteBuffer start_key) {
this.start_key = start_key;
return this;
}
@@ -231,10 +247,20 @@ public class KeyRange implements TBase<K
}
public byte[] getEnd_key() {
- return this.end_key;
+ setEnd_key(TBaseHelper.rightSize(end_key));
+ return end_key.array();
+ }
+
+ public ByteBuffer BufferForEnd_key() {
+ return end_key;
}
public KeyRange setEnd_key(byte[] end_key) {
+ setEnd_key(ByteBuffer.wrap(end_key));
+ return this;
+ }
+
+ public KeyRange setEnd_key(ByteBuffer end_key) {
this.end_key = end_key;
return this;
}
@@ -331,7 +357,7 @@ public class KeyRange implements TBase<K
if (value == null) {
unsetStart_key();
} else {
- setStart_key((byte[])value);
+ setStart_key((ByteBuffer)value);
}
break;
@@ -339,7 +365,7 @@ public class KeyRange implements TBase<K
if (value == null) {
unsetEnd_key();
} else {
- setEnd_key((byte[])value);
+ setEnd_key((ByteBuffer)value);
}
break;
@@ -370,10 +396,6 @@ public class KeyRange implements TBase<K
}
}
- public void setFieldValue(int fieldID, Object value) {
- setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
- }
-
public Object getFieldValue(_Fields field) {
switch (field) {
case START_KEY:
@@ -395,12 +417,12 @@ public class KeyRange implements TBase<K
throw new IllegalStateException();
}
- public Object getFieldValue(int fieldId) {
- return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
- }
-
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
+ if (field == null) {
+ throw new IllegalArgumentException();
+ }
+
switch (field) {
case START_KEY:
return isSetStart_key();
@@ -416,10 +438,6 @@ public class KeyRange implements TBase<K
throw new IllegalStateException();
}
- public boolean isSet(int fieldID) {
- return isSet(_Fields.findByThriftIdOrThrow(fieldID));
- }
-
@Override
public boolean equals(Object that) {
if (that == null)
@@ -438,7 +456,7 @@ public class KeyRange implements TBase<K
if (this_present_start_key || that_present_start_key) {
if (!(this_present_start_key && that_present_start_key))
return false;
- if (!java.util.Arrays.equals(this.start_key, that.start_key))
+ if (!this.start_key.equals(that.start_key))
return false;
}
@@ -447,7 +465,7 @@ public class KeyRange implements TBase<K
if (this_present_end_key || that_present_end_key) {
if (!(this_present_end_key && that_present_end_key))
return false;
- if (!java.util.Arrays.equals(this.end_key, that.end_key))
+ if (!this.end_key.equals(that.end_key))
return false;
}
@@ -525,7 +543,8 @@ public class KeyRange implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetStart_key()) { lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
+ if (isSetStart_key()) {
+ lastComparison = TBaseHelper.compareTo(this.start_key, typedOther.start_key);
if (lastComparison != 0) {
return lastComparison;
}
@@ -534,7 +553,8 @@ public class KeyRange implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetEnd_key()) { lastComparison = TBaseHelper.compareTo(this.end_key, typedOther.end_key);
+ if (isSetEnd_key()) {
+ lastComparison = TBaseHelper.compareTo(this.end_key, typedOther.end_key);
if (lastComparison != 0) {
return lastComparison;
}
@@ -543,7 +563,8 @@ public class KeyRange implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetStart_token()) { lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
+ if (isSetStart_token()) {
+ lastComparison = TBaseHelper.compareTo(this.start_token, typedOther.start_token);
if (lastComparison != 0) {
return lastComparison;
}
@@ -552,7 +573,8 @@ public class KeyRange implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetEnd_token()) { lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
+ if (isSetEnd_token()) {
+ lastComparison = TBaseHelper.compareTo(this.end_token, typedOther.end_token);
if (lastComparison != 0) {
return lastComparison;
}
@@ -561,7 +583,8 @@ public class KeyRange implements TBase<K
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
+ if (isSetCount()) {
+ lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
if (lastComparison != 0) {
return lastComparison;
}
@@ -569,6 +592,10 @@ public class KeyRange implements TBase<K
return 0;
}
+ public _Fields fieldForId(int fieldId) {
+ return _Fields.findByThriftId(fieldId);
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -678,12 +705,7 @@ public class KeyRange implements TBase<K
if (this.start_key == null) {
sb.append("null");
} else {
- int __start_key_size = Math.min(this.start_key.length, 128);
- for (int i = 0; i < __start_key_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.start_key[i]).length() > 1 ? Integer.toHexString(this.start_key[i]).substring(Integer.toHexString(this.start_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.start_key[i]).toUpperCase());
- }
- if (this.start_key.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.start_key, sb);
}
first = false;
}
@@ -693,12 +715,7 @@ public class KeyRange implements TBase<K
if (this.end_key == null) {
sb.append("null");
} else {
- int __end_key_size = Math.min(this.end_key.length, 128);
- for (int i = 0; i < __end_key_size; i++) {
- if (i != 0) sb.append(" ");
- sb.append(Integer.toHexString(this.end_key[i]).length() > 1 ? Integer.toHexString(this.end_key[i]).substring(Integer.toHexString(this.end_key[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.end_key[i]).toUpperCase());
- }
- if (this.end_key.length > 128) sb.append(" ...");
+ TBaseHelper.toString(this.end_key, sb);
}
first = false;
}