http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/data/thrift/TKey.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKey.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKey.java index fc66459..9121dfd 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKey.java +++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKey.java @@ -15,42 +15,15 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.data.thrift; -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 org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.io.Serializable, Cloneable, Comparable<TKey> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TKey"); @@ -60,16 +33,13 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i private static final org.apache.thrift.protocol.TField COL_VISIBILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("colVisibility", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)5); - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TKeyStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TKeyTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TKeyStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TKeyTupleSchemeFactory(); - public ByteBuffer row; // required - public ByteBuffer colFamily; // required - public ByteBuffer colQualifier; // required - public ByteBuffer colVisibility; // required + public java.nio.ByteBuffer row; // required + public java.nio.ByteBuffer colFamily; // required + public java.nio.ByteBuffer colQualifier; // required + public java.nio.ByteBuffer colVisibility; // required public long timestamp; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @@ -80,10 +50,10 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i COL_VISIBILITY((short)4, "colVisibility"), TIMESTAMP((short)5, "timestamp"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -114,21 +84,21 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -137,7 +107,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } @@ -145,9 +115,9 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i // isset id assignments private static final int __TIMESTAMP_ISSET_ID = 0; private byte __isset_bitfield = 0; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.COL_FAMILY, new org.apache.thrift.meta_data.FieldMetaData("colFamily", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -158,7 +128,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TKey.class, metaDataMap); } @@ -166,10 +136,10 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } public TKey( - ByteBuffer row, - ByteBuffer colFamily, - ByteBuffer colQualifier, - ByteBuffer colVisibility, + java.nio.ByteBuffer row, + java.nio.ByteBuffer colFamily, + java.nio.ByteBuffer colQualifier, + java.nio.ByteBuffer colVisibility, long timestamp) { this(); @@ -220,16 +190,16 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return row == null ? null : row.array(); } - public ByteBuffer bufferForRow() { + public java.nio.ByteBuffer bufferForRow() { return org.apache.thrift.TBaseHelper.copyBinary(row); } public TKey setRow(byte[] row) { - this.row = row == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(row, row.length)); + this.row = row == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(row.clone()); return this; } - public TKey setRow(ByteBuffer row) { + public TKey setRow(java.nio.ByteBuffer row) { this.row = org.apache.thrift.TBaseHelper.copyBinary(row); return this; } @@ -254,16 +224,16 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return colFamily == null ? null : colFamily.array(); } - public ByteBuffer bufferForColFamily() { + public java.nio.ByteBuffer bufferForColFamily() { return org.apache.thrift.TBaseHelper.copyBinary(colFamily); } public TKey setColFamily(byte[] colFamily) { - this.colFamily = colFamily == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(colFamily, colFamily.length)); + this.colFamily = colFamily == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colFamily.clone()); return this; } - public TKey setColFamily(ByteBuffer colFamily) { + public TKey setColFamily(java.nio.ByteBuffer colFamily) { this.colFamily = org.apache.thrift.TBaseHelper.copyBinary(colFamily); return this; } @@ -288,16 +258,16 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return colQualifier == null ? null : colQualifier.array(); } - public ByteBuffer bufferForColQualifier() { + public java.nio.ByteBuffer bufferForColQualifier() { return org.apache.thrift.TBaseHelper.copyBinary(colQualifier); } public TKey setColQualifier(byte[] colQualifier) { - this.colQualifier = colQualifier == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(colQualifier, colQualifier.length)); + this.colQualifier = colQualifier == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colQualifier.clone()); return this; } - public TKey setColQualifier(ByteBuffer colQualifier) { + public TKey setColQualifier(java.nio.ByteBuffer colQualifier) { this.colQualifier = org.apache.thrift.TBaseHelper.copyBinary(colQualifier); return this; } @@ -322,16 +292,16 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return colVisibility == null ? null : colVisibility.array(); } - public ByteBuffer bufferForColVisibility() { + public java.nio.ByteBuffer bufferForColVisibility() { return org.apache.thrift.TBaseHelper.copyBinary(colVisibility); } public TKey setColVisibility(byte[] colVisibility) { - this.colVisibility = colVisibility == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(colVisibility, colVisibility.length)); + this.colVisibility = colVisibility == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(colVisibility.clone()); return this; } - public TKey setColVisibility(ByteBuffer colVisibility) { + public TKey setColVisibility(java.nio.ByteBuffer colVisibility) { this.colVisibility = org.apache.thrift.TBaseHelper.copyBinary(colVisibility); return this; } @@ -362,25 +332,29 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } public void unsetTimestamp() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); } /** Returns true if field timestamp is set (has been assigned a value) and false otherwise */ public boolean isSetTimestamp() { - return EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __TIMESTAMP_ISSET_ID); } public void setTimestampIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value); + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value); } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case ROW: if (value == null) { unsetRow(); } else { - setRow((ByteBuffer)value); + if (value instanceof byte[]) { + setRow((byte[])value); + } else { + setRow((java.nio.ByteBuffer)value); + } } break; @@ -388,7 +362,11 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i if (value == null) { unsetColFamily(); } else { - setColFamily((ByteBuffer)value); + if (value instanceof byte[]) { + setColFamily((byte[])value); + } else { + setColFamily((java.nio.ByteBuffer)value); + } } break; @@ -396,7 +374,11 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i if (value == null) { unsetColQualifier(); } else { - setColQualifier((ByteBuffer)value); + if (value instanceof byte[]) { + setColQualifier((byte[])value); + } else { + setColQualifier((java.nio.ByteBuffer)value); + } } break; @@ -404,7 +386,11 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i if (value == null) { unsetColVisibility(); } else { - setColVisibility((ByteBuffer)value); + if (value instanceof byte[]) { + setColVisibility((byte[])value); + } else { + setColVisibility((java.nio.ByteBuffer)value); + } } break; @@ -412,14 +398,14 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i if (value == null) { unsetTimestamp(); } else { - setTimestamp((Long)value); + setTimestamp((java.lang.Long)value); } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case ROW: return getRow(); @@ -437,13 +423,13 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return getTimestamp(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -458,11 +444,11 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i case TIMESTAMP: return isSetTimestamp(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TKey) @@ -473,6 +459,8 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i public boolean equals(TKey that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_row = true && this.isSetRow(); boolean that_present_row = true && that.isSetRow(); @@ -524,34 +512,27 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_row = true && (isSetRow()); - list.add(present_row); - if (present_row) - list.add(row); + hashCode = hashCode * 8191 + ((isSetRow()) ? 131071 : 524287); + if (isSetRow()) + hashCode = hashCode * 8191 + row.hashCode(); - boolean present_colFamily = true && (isSetColFamily()); - list.add(present_colFamily); - if (present_colFamily) - list.add(colFamily); + hashCode = hashCode * 8191 + ((isSetColFamily()) ? 131071 : 524287); + if (isSetColFamily()) + hashCode = hashCode * 8191 + colFamily.hashCode(); - boolean present_colQualifier = true && (isSetColQualifier()); - list.add(present_colQualifier); - if (present_colQualifier) - list.add(colQualifier); + hashCode = hashCode * 8191 + ((isSetColQualifier()) ? 131071 : 524287); + if (isSetColQualifier()) + hashCode = hashCode * 8191 + colQualifier.hashCode(); - boolean present_colVisibility = true && (isSetColVisibility()); - list.add(present_colVisibility); - if (present_colVisibility) - list.add(colVisibility); + hashCode = hashCode * 8191 + ((isSetColVisibility()) ? 131071 : 524287); + if (isSetColVisibility()) + hashCode = hashCode * 8191 + colVisibility.hashCode(); - boolean present_timestamp = true; - list.add(present_timestamp); - if (present_timestamp) - list.add(timestamp); + hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(timestamp); - return list.hashCode(); + return hashCode; } @Override @@ -562,7 +543,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetRow()).compareTo(other.isSetRow()); + lastComparison = java.lang.Boolean.valueOf(isSetRow()).compareTo(other.isSetRow()); if (lastComparison != 0) { return lastComparison; } @@ -572,7 +553,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetColFamily()).compareTo(other.isSetColFamily()); + lastComparison = java.lang.Boolean.valueOf(isSetColFamily()).compareTo(other.isSetColFamily()); if (lastComparison != 0) { return lastComparison; } @@ -582,7 +563,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetColQualifier()).compareTo(other.isSetColQualifier()); + lastComparison = java.lang.Boolean.valueOf(isSetColQualifier()).compareTo(other.isSetColQualifier()); if (lastComparison != 0) { return lastComparison; } @@ -592,7 +573,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetColVisibility()).compareTo(other.isSetColVisibility()); + lastComparison = java.lang.Boolean.valueOf(isSetColVisibility()).compareTo(other.isSetColVisibility()); if (lastComparison != 0) { return lastComparison; } @@ -602,7 +583,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i return lastComparison; } } - lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp()); + lastComparison = java.lang.Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp()); if (lastComparison != 0) { return lastComparison; } @@ -620,16 +601,16 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("TKey("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("TKey("); boolean first = true; sb.append("row:"); @@ -684,7 +665,7 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; @@ -694,13 +675,13 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } } - private static class TKeyStandardSchemeFactory implements SchemeFactory { + private static class TKeyStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyStandardScheme getScheme() { return new TKeyStandardScheme(); } } - private static class TKeyStandardScheme extends StandardScheme<TKey> { + private static class TKeyStandardScheme extends org.apache.thrift.scheme.StandardScheme<TKey> { public void read(org.apache.thrift.protocol.TProtocol iprot, TKey struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -796,18 +777,18 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } - private static class TKeyTupleSchemeFactory implements SchemeFactory { + private static class TKeyTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyTupleScheme getScheme() { return new TKeyTupleScheme(); } } - private static class TKeyTupleScheme extends TupleScheme<TKey> { + private static class TKeyTupleScheme extends org.apache.thrift.scheme.TupleScheme<TKey> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TKey struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetRow()) { optionals.set(0); } @@ -843,8 +824,8 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i @Override public void read(org.apache.thrift.protocol.TProtocol prot, TKey struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(5); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.row = iprot.readBinary(); struct.setRowIsSet(true); @@ -868,5 +849,9 @@ public class TKey implements org.apache.thrift.TBase<TKey, TKey._Fields>, java.i } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} }
http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyExtent.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyExtent.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyExtent.java index 9aaa4dc..283c9bf 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyExtent.java +++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyExtent.java @@ -15,42 +15,15 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.data.thrift; -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 org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExtent._Fields>, java.io.Serializable, Cloneable, Comparable<TKeyExtent> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TKeyExtent"); @@ -58,15 +31,12 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten private static final org.apache.thrift.protocol.TField END_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("endRow", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField PREV_END_ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("prevEndRow", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TKeyExtentStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TKeyExtentTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TKeyExtentStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TKeyExtentTupleSchemeFactory(); - public ByteBuffer table; // required - public ByteBuffer endRow; // required - public ByteBuffer prevEndRow; // required + public java.nio.ByteBuffer table; // required + public java.nio.ByteBuffer endRow; // required + public java.nio.ByteBuffer prevEndRow; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -74,10 +44,10 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten END_ROW((short)2, "endRow"), PREV_END_ROW((short)3, "prevEndRow"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -104,21 +74,21 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -127,22 +97,22 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.TABLE, new org.apache.thrift.meta_data.FieldMetaData("table", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.END_ROW, new org.apache.thrift.meta_data.FieldMetaData("endRow", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.PREV_END_ROW, new org.apache.thrift.meta_data.FieldMetaData("prevEndRow", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TKeyExtent.class, metaDataMap); } @@ -150,9 +120,9 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } public TKeyExtent( - ByteBuffer table, - ByteBuffer endRow, - ByteBuffer prevEndRow) + java.nio.ByteBuffer table, + java.nio.ByteBuffer endRow, + java.nio.ByteBuffer prevEndRow) { this(); this.table = org.apache.thrift.TBaseHelper.copyBinary(table); @@ -191,16 +161,16 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return table == null ? null : table.array(); } - public ByteBuffer bufferForTable() { + public java.nio.ByteBuffer bufferForTable() { return org.apache.thrift.TBaseHelper.copyBinary(table); } public TKeyExtent setTable(byte[] table) { - this.table = table == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(table, table.length)); + this.table = table == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(table.clone()); return this; } - public TKeyExtent setTable(ByteBuffer table) { + public TKeyExtent setTable(java.nio.ByteBuffer table) { this.table = org.apache.thrift.TBaseHelper.copyBinary(table); return this; } @@ -225,16 +195,16 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return endRow == null ? null : endRow.array(); } - public ByteBuffer bufferForEndRow() { + public java.nio.ByteBuffer bufferForEndRow() { return org.apache.thrift.TBaseHelper.copyBinary(endRow); } public TKeyExtent setEndRow(byte[] endRow) { - this.endRow = endRow == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(endRow, endRow.length)); + this.endRow = endRow == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(endRow.clone()); return this; } - public TKeyExtent setEndRow(ByteBuffer endRow) { + public TKeyExtent setEndRow(java.nio.ByteBuffer endRow) { this.endRow = org.apache.thrift.TBaseHelper.copyBinary(endRow); return this; } @@ -259,16 +229,16 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return prevEndRow == null ? null : prevEndRow.array(); } - public ByteBuffer bufferForPrevEndRow() { + public java.nio.ByteBuffer bufferForPrevEndRow() { return org.apache.thrift.TBaseHelper.copyBinary(prevEndRow); } public TKeyExtent setPrevEndRow(byte[] prevEndRow) { - this.prevEndRow = prevEndRow == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(prevEndRow, prevEndRow.length)); + this.prevEndRow = prevEndRow == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(prevEndRow.clone()); return this; } - public TKeyExtent setPrevEndRow(ByteBuffer prevEndRow) { + public TKeyExtent setPrevEndRow(java.nio.ByteBuffer prevEndRow) { this.prevEndRow = org.apache.thrift.TBaseHelper.copyBinary(prevEndRow); return this; } @@ -288,13 +258,17 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case TABLE: if (value == null) { unsetTable(); } else { - setTable((ByteBuffer)value); + if (value instanceof byte[]) { + setTable((byte[])value); + } else { + setTable((java.nio.ByteBuffer)value); + } } break; @@ -302,7 +276,11 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten if (value == null) { unsetEndRow(); } else { - setEndRow((ByteBuffer)value); + if (value instanceof byte[]) { + setEndRow((byte[])value); + } else { + setEndRow((java.nio.ByteBuffer)value); + } } break; @@ -310,14 +288,18 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten if (value == null) { unsetPrevEndRow(); } else { - setPrevEndRow((ByteBuffer)value); + if (value instanceof byte[]) { + setPrevEndRow((byte[])value); + } else { + setPrevEndRow((java.nio.ByteBuffer)value); + } } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case TABLE: return getTable(); @@ -329,13 +311,13 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return getPrevEndRow(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -346,11 +328,11 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten case PREV_END_ROW: return isSetPrevEndRow(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TKeyExtent) @@ -361,6 +343,8 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten public boolean equals(TKeyExtent that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_table = true && this.isSetTable(); boolean that_present_table = true && that.isSetTable(); @@ -394,24 +378,21 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_table = true && (isSetTable()); - list.add(present_table); - if (present_table) - list.add(table); + hashCode = hashCode * 8191 + ((isSetTable()) ? 131071 : 524287); + if (isSetTable()) + hashCode = hashCode * 8191 + table.hashCode(); - boolean present_endRow = true && (isSetEndRow()); - list.add(present_endRow); - if (present_endRow) - list.add(endRow); + hashCode = hashCode * 8191 + ((isSetEndRow()) ? 131071 : 524287); + if (isSetEndRow()) + hashCode = hashCode * 8191 + endRow.hashCode(); - boolean present_prevEndRow = true && (isSetPrevEndRow()); - list.add(present_prevEndRow); - if (present_prevEndRow) - list.add(prevEndRow); + hashCode = hashCode * 8191 + ((isSetPrevEndRow()) ? 131071 : 524287); + if (isSetPrevEndRow()) + hashCode = hashCode * 8191 + prevEndRow.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -422,7 +403,7 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetTable()).compareTo(other.isSetTable()); + lastComparison = java.lang.Boolean.valueOf(isSetTable()).compareTo(other.isSetTable()); if (lastComparison != 0) { return lastComparison; } @@ -432,7 +413,7 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return lastComparison; } } - lastComparison = Boolean.valueOf(isSetEndRow()).compareTo(other.isSetEndRow()); + lastComparison = java.lang.Boolean.valueOf(isSetEndRow()).compareTo(other.isSetEndRow()); if (lastComparison != 0) { return lastComparison; } @@ -442,7 +423,7 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten return lastComparison; } } - lastComparison = Boolean.valueOf(isSetPrevEndRow()).compareTo(other.isSetPrevEndRow()); + lastComparison = java.lang.Boolean.valueOf(isSetPrevEndRow()).compareTo(other.isSetPrevEndRow()); if (lastComparison != 0) { return lastComparison; } @@ -460,16 +441,16 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("TKeyExtent("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("TKeyExtent("); boolean first = true; sb.append("table:"); @@ -512,7 +493,7 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { @@ -520,13 +501,13 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } } - private static class TKeyExtentStandardSchemeFactory implements SchemeFactory { + private static class TKeyExtentStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyExtentStandardScheme getScheme() { return new TKeyExtentStandardScheme(); } } - private static class TKeyExtentStandardScheme extends StandardScheme<TKeyExtent> { + private static class TKeyExtentStandardScheme extends org.apache.thrift.scheme.StandardScheme<TKeyExtent> { public void read(org.apache.thrift.protocol.TProtocol iprot, TKeyExtent struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -598,18 +579,18 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } - private static class TKeyExtentTupleSchemeFactory implements SchemeFactory { + private static class TKeyExtentTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyExtentTupleScheme getScheme() { return new TKeyExtentTupleScheme(); } } - private static class TKeyExtentTupleScheme extends TupleScheme<TKeyExtent> { + private static class TKeyExtentTupleScheme extends org.apache.thrift.scheme.TupleScheme<TKeyExtent> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TKeyExtent struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetTable()) { optionals.set(0); } @@ -633,8 +614,8 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten @Override public void read(org.apache.thrift.protocol.TProtocol prot, TKeyExtent struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.table = iprot.readBinary(); struct.setTableIsSet(true); @@ -650,5 +631,9 @@ public class TKeyExtent implements org.apache.thrift.TBase<TKeyExtent, TKeyExten } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} } http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyValue.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyValue.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyValue.java index 01a3820..4968dec 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyValue.java +++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TKeyValue.java @@ -15,66 +15,36 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.data.thrift; -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 org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._Fields>, java.io.Serializable, Cloneable, Comparable<TKeyValue> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TKeyValue"); private static final org.apache.thrift.protocol.TField KEY_FIELD_DESC = new org.apache.thrift.protocol.TField("key", org.apache.thrift.protocol.TType.STRUCT, (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.STRING, (short)2); - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TKeyValueStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TKeyValueTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TKeyValueStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TKeyValueTupleSchemeFactory(); public TKey key; // required - public ByteBuffer value; // required + public java.nio.ByteBuffer value; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { KEY((short)1, "key"), VALUE((short)2, "value"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -99,21 +69,21 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -122,20 +92,20 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } // isset id assignments - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.KEY, new org.apache.thrift.meta_data.FieldMetaData("key", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TKey.class))); tmpMap.put(_Fields.VALUE, new org.apache.thrift.meta_data.FieldMetaData("value", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TKeyValue.class, metaDataMap); } @@ -144,7 +114,7 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ public TKeyValue( TKey key, - ByteBuffer value) + java.nio.ByteBuffer value) { this(); this.key = key; @@ -202,16 +172,16 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ return value == null ? null : value.array(); } - public ByteBuffer bufferForValue() { + public java.nio.ByteBuffer bufferForValue() { return org.apache.thrift.TBaseHelper.copyBinary(value); } public TKeyValue setValue(byte[] value) { - this.value = value == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(value, value.length)); + this.value = value == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(value.clone()); return this; } - public TKeyValue setValue(ByteBuffer value) { + public TKeyValue setValue(java.nio.ByteBuffer value) { this.value = org.apache.thrift.TBaseHelper.copyBinary(value); return this; } @@ -231,7 +201,7 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case KEY: if (value == null) { @@ -245,14 +215,18 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ if (value == null) { unsetValue(); } else { - setValue((ByteBuffer)value); + if (value instanceof byte[]) { + setValue((byte[])value); + } else { + setValue((java.nio.ByteBuffer)value); + } } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case KEY: return getKey(); @@ -261,13 +235,13 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ return getValue(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -276,11 +250,11 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ case VALUE: return isSetValue(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TKeyValue) @@ -291,6 +265,8 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ public boolean equals(TKeyValue that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_key = true && this.isSetKey(); boolean that_present_key = true && that.isSetKey(); @@ -315,19 +291,17 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_key = true && (isSetKey()); - list.add(present_key); - if (present_key) - list.add(key); + hashCode = hashCode * 8191 + ((isSetKey()) ? 131071 : 524287); + if (isSetKey()) + hashCode = hashCode * 8191 + key.hashCode(); - boolean present_value = true && (isSetValue()); - list.add(present_value); - if (present_value) - list.add(value); + hashCode = hashCode * 8191 + ((isSetValue()) ? 131071 : 524287); + if (isSetValue()) + hashCode = hashCode * 8191 + value.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -338,7 +312,7 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetKey()).compareTo(other.isSetKey()); + lastComparison = java.lang.Boolean.valueOf(isSetKey()).compareTo(other.isSetKey()); if (lastComparison != 0) { return lastComparison; } @@ -348,7 +322,7 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ return lastComparison; } } - lastComparison = Boolean.valueOf(isSetValue()).compareTo(other.isSetValue()); + lastComparison = java.lang.Boolean.valueOf(isSetValue()).compareTo(other.isSetValue()); if (lastComparison != 0) { return lastComparison; } @@ -366,16 +340,16 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("TKeyValue("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("TKeyValue("); boolean first = true; sb.append("key:"); @@ -413,7 +387,7 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { @@ -421,13 +395,13 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } } - private static class TKeyValueStandardSchemeFactory implements SchemeFactory { + private static class TKeyValueStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyValueStandardScheme getScheme() { return new TKeyValueStandardScheme(); } } - private static class TKeyValueStandardScheme extends StandardScheme<TKeyValue> { + private static class TKeyValueStandardScheme extends org.apache.thrift.scheme.StandardScheme<TKeyValue> { public void read(org.apache.thrift.protocol.TProtocol iprot, TKeyValue struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -487,18 +461,18 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } - private static class TKeyValueTupleSchemeFactory implements SchemeFactory { + private static class TKeyValueTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TKeyValueTupleScheme getScheme() { return new TKeyValueTupleScheme(); } } - private static class TKeyValueTupleScheme extends TupleScheme<TKeyValue> { + private static class TKeyValueTupleScheme extends org.apache.thrift.scheme.TupleScheme<TKeyValue> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TKeyValue struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetKey()) { optionals.set(0); } @@ -516,8 +490,8 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ @Override public void read(org.apache.thrift.protocol.TProtocol prot, TKeyValue struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(2); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.key = new TKey(); struct.key.read(iprot); @@ -530,5 +504,9 @@ public class TKeyValue implements org.apache.thrift.TBase<TKeyValue, TKeyValue._ } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} } http://git-wip-us.apache.org/repos/asf/accumulo/blob/62bbce43/core/src/main/java/org/apache/accumulo/core/data/thrift/TMutation.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/thrift/TMutation.java b/core/src/main/java/org/apache/accumulo/core/data/thrift/TMutation.java index 1a153a9..79fe3b1 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/thrift/TMutation.java +++ b/core/src/main/java/org/apache/accumulo/core/data/thrift/TMutation.java @@ -15,42 +15,15 @@ * limitations under the License. */ /** - * Autogenerated by Thrift Compiler (0.9.3) + * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package org.apache.accumulo.core.data.thrift; -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 org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._Fields>, java.io.Serializable, Cloneable, Comparable<TMutation> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TMutation"); @@ -60,17 +33,14 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ private static final org.apache.thrift.protocol.TField ENTRIES_FIELD_DESC = new org.apache.thrift.protocol.TField("entries", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField SOURCES_FIELD_DESC = new org.apache.thrift.protocol.TField("sources", org.apache.thrift.protocol.TType.LIST, (short)5); - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); - static { - schemes.put(StandardScheme.class, new TMutationStandardSchemeFactory()); - schemes.put(TupleScheme.class, new TMutationTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TMutationStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TMutationTupleSchemeFactory(); - public ByteBuffer row; // required - public ByteBuffer data; // required - public List<ByteBuffer> values; // required + public java.nio.ByteBuffer row; // required + public java.nio.ByteBuffer data; // required + public java.util.List<java.nio.ByteBuffer> values; // required public int entries; // required - public List<String> sources; // optional + public java.util.List<java.lang.String> sources; // 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 { @@ -80,10 +50,10 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ ENTRIES((short)4, "entries"), SOURCES((short)5, "sources"); - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { + for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } @@ -114,21 +84,21 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ - public static _Fields findByName(String name) { + public static _Fields findByName(java.lang.String name) { return byName.get(name); } private final short _thriftId; - private final String _fieldName; + private final java.lang.String _fieldName; - _Fields(short thriftId, String fieldName) { + _Fields(short thriftId, java.lang.String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } @@ -137,7 +107,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return _thriftId; } - public String getFieldName() { + public java.lang.String getFieldName() { return _fieldName; } } @@ -146,9 +116,9 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ private static final int __ENTRIES_ISSET_ID = 0; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.SOURCES}; - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + public static final java.util.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); + java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.ROW, new org.apache.thrift.meta_data.FieldMetaData("row", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -161,7 +131,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ tmpMap.put(_Fields.SOURCES, new org.apache.thrift.meta_data.FieldMetaData("sources", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); + metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TMutation.class, metaDataMap); } @@ -169,9 +139,9 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } public TMutation( - ByteBuffer row, - ByteBuffer data, - List<ByteBuffer> values, + java.nio.ByteBuffer row, + java.nio.ByteBuffer data, + java.util.List<java.nio.ByteBuffer> values, int entries) { this(); @@ -194,12 +164,12 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ this.data = org.apache.thrift.TBaseHelper.copyBinary(other.data); } if (other.isSetValues()) { - List<ByteBuffer> __this__values = new ArrayList<ByteBuffer>(other.values); + java.util.List<java.nio.ByteBuffer> __this__values = new java.util.ArrayList<java.nio.ByteBuffer>(other.values); this.values = __this__values; } this.entries = other.entries; if (other.isSetSources()) { - List<String> __this__sources = new ArrayList<String>(other.sources); + java.util.List<java.lang.String> __this__sources = new java.util.ArrayList<java.lang.String>(other.sources); this.sources = __this__sources; } } @@ -223,16 +193,16 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return row == null ? null : row.array(); } - public ByteBuffer bufferForRow() { + public java.nio.ByteBuffer bufferForRow() { return org.apache.thrift.TBaseHelper.copyBinary(row); } public TMutation setRow(byte[] row) { - this.row = row == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(row, row.length)); + this.row = row == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(row.clone()); return this; } - public TMutation setRow(ByteBuffer row) { + public TMutation setRow(java.nio.ByteBuffer row) { this.row = org.apache.thrift.TBaseHelper.copyBinary(row); return this; } @@ -257,16 +227,16 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return data == null ? null : data.array(); } - public ByteBuffer bufferForData() { + public java.nio.ByteBuffer bufferForData() { return org.apache.thrift.TBaseHelper.copyBinary(data); } public TMutation setData(byte[] data) { - this.data = data == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(data, data.length)); + this.data = data == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(data.clone()); return this; } - public TMutation setData(ByteBuffer data) { + public TMutation setData(java.nio.ByteBuffer data) { this.data = org.apache.thrift.TBaseHelper.copyBinary(data); return this; } @@ -290,22 +260,22 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return (this.values == null) ? 0 : this.values.size(); } - public java.util.Iterator<ByteBuffer> getValuesIterator() { + public java.util.Iterator<java.nio.ByteBuffer> getValuesIterator() { return (this.values == null) ? null : this.values.iterator(); } - public void addToValues(ByteBuffer elem) { + public void addToValues(java.nio.ByteBuffer elem) { if (this.values == null) { - this.values = new ArrayList<ByteBuffer>(); + this.values = new java.util.ArrayList<java.nio.ByteBuffer>(); } this.values.add(elem); } - public List<ByteBuffer> getValues() { + public java.util.List<java.nio.ByteBuffer> getValues() { return this.values; } - public TMutation setValues(List<ByteBuffer> values) { + public TMutation setValues(java.util.List<java.nio.ByteBuffer> values) { this.values = values; return this; } @@ -336,38 +306,38 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } public void unsetEntries() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ENTRIES_ISSET_ID); + __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ENTRIES_ISSET_ID); } /** Returns true if field entries is set (has been assigned a value) and false otherwise */ public boolean isSetEntries() { - return EncodingUtils.testBit(__isset_bitfield, __ENTRIES_ISSET_ID); + return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENTRIES_ISSET_ID); } public void setEntriesIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ENTRIES_ISSET_ID, value); + __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ENTRIES_ISSET_ID, value); } public int getSourcesSize() { return (this.sources == null) ? 0 : this.sources.size(); } - public java.util.Iterator<String> getSourcesIterator() { + public java.util.Iterator<java.lang.String> getSourcesIterator() { return (this.sources == null) ? null : this.sources.iterator(); } - public void addToSources(String elem) { + public void addToSources(java.lang.String elem) { if (this.sources == null) { - this.sources = new ArrayList<String>(); + this.sources = new java.util.ArrayList<java.lang.String>(); } this.sources.add(elem); } - public List<String> getSources() { + public java.util.List<java.lang.String> getSources() { return this.sources; } - public TMutation setSources(List<String> sources) { + public TMutation setSources(java.util.List<java.lang.String> sources) { this.sources = sources; return this; } @@ -387,13 +357,17 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } } - public void setFieldValue(_Fields field, Object value) { + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case ROW: if (value == null) { unsetRow(); } else { - setRow((ByteBuffer)value); + if (value instanceof byte[]) { + setRow((byte[])value); + } else { + setRow((java.nio.ByteBuffer)value); + } } break; @@ -401,7 +375,11 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (value == null) { unsetData(); } else { - setData((ByteBuffer)value); + if (value instanceof byte[]) { + setData((byte[])value); + } else { + setData((java.nio.ByteBuffer)value); + } } break; @@ -409,7 +387,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (value == null) { unsetValues(); } else { - setValues((List<ByteBuffer>)value); + setValues((java.util.List<java.nio.ByteBuffer>)value); } break; @@ -417,7 +395,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (value == null) { unsetEntries(); } else { - setEntries((Integer)value); + setEntries((java.lang.Integer)value); } break; @@ -425,14 +403,14 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (value == null) { unsetSources(); } else { - setSources((List<String>)value); + setSources((java.util.List<java.lang.String>)value); } break; } } - public Object getFieldValue(_Fields field) { + public java.lang.Object getFieldValue(_Fields field) { switch (field) { case ROW: return getRow(); @@ -450,13 +428,13 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return getSources(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { - throw new IllegalArgumentException(); + throw new java.lang.IllegalArgumentException(); } switch (field) { @@ -471,11 +449,11 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ case SOURCES: return isSetSources(); } - throw new IllegalStateException(); + throw new java.lang.IllegalStateException(); } @Override - public boolean equals(Object that) { + public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TMutation) @@ -486,6 +464,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ public boolean equals(TMutation that) { if (that == null) return false; + if (this == that) + return true; boolean this_present_row = true && this.isSetRow(); boolean that_present_row = true && that.isSetRow(); @@ -537,34 +517,27 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ @Override public int hashCode() { - List<Object> list = new ArrayList<Object>(); + int hashCode = 1; - boolean present_row = true && (isSetRow()); - list.add(present_row); - if (present_row) - list.add(row); + hashCode = hashCode * 8191 + ((isSetRow()) ? 131071 : 524287); + if (isSetRow()) + hashCode = hashCode * 8191 + row.hashCode(); - boolean present_data = true && (isSetData()); - list.add(present_data); - if (present_data) - list.add(data); + hashCode = hashCode * 8191 + ((isSetData()) ? 131071 : 524287); + if (isSetData()) + hashCode = hashCode * 8191 + data.hashCode(); - boolean present_values = true && (isSetValues()); - list.add(present_values); - if (present_values) - list.add(values); + hashCode = hashCode * 8191 + ((isSetValues()) ? 131071 : 524287); + if (isSetValues()) + hashCode = hashCode * 8191 + values.hashCode(); - boolean present_entries = true; - list.add(present_entries); - if (present_entries) - list.add(entries); + hashCode = hashCode * 8191 + entries; - boolean present_sources = true && (isSetSources()); - list.add(present_sources); - if (present_sources) - list.add(sources); + hashCode = hashCode * 8191 + ((isSetSources()) ? 131071 : 524287); + if (isSetSources()) + hashCode = hashCode * 8191 + sources.hashCode(); - return list.hashCode(); + return hashCode; } @Override @@ -575,7 +548,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetRow()).compareTo(other.isSetRow()); + lastComparison = java.lang.Boolean.valueOf(isSetRow()).compareTo(other.isSetRow()); if (lastComparison != 0) { return lastComparison; } @@ -585,7 +558,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return lastComparison; } } - lastComparison = Boolean.valueOf(isSetData()).compareTo(other.isSetData()); + lastComparison = java.lang.Boolean.valueOf(isSetData()).compareTo(other.isSetData()); if (lastComparison != 0) { return lastComparison; } @@ -595,7 +568,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return lastComparison; } } - lastComparison = Boolean.valueOf(isSetValues()).compareTo(other.isSetValues()); + lastComparison = java.lang.Boolean.valueOf(isSetValues()).compareTo(other.isSetValues()); if (lastComparison != 0) { return lastComparison; } @@ -605,7 +578,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return lastComparison; } } - lastComparison = Boolean.valueOf(isSetEntries()).compareTo(other.isSetEntries()); + lastComparison = java.lang.Boolean.valueOf(isSetEntries()).compareTo(other.isSetEntries()); if (lastComparison != 0) { return lastComparison; } @@ -615,7 +588,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ return lastComparison; } } - lastComparison = Boolean.valueOf(isSetSources()).compareTo(other.isSetSources()); + lastComparison = java.lang.Boolean.valueOf(isSetSources()).compareTo(other.isSetSources()); if (lastComparison != 0) { return lastComparison; } @@ -633,16 +606,16 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + scheme(iprot).read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + scheme(oprot).write(oprot, this); } @Override - public String toString() { - StringBuilder sb = new StringBuilder("TMutation("); + public java.lang.String toString() { + java.lang.StringBuilder sb = new java.lang.StringBuilder("TMutation("); boolean first = true; sb.append("row:"); @@ -699,7 +672,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } } - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; @@ -709,13 +682,13 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } } - private static class TMutationStandardSchemeFactory implements SchemeFactory { + private static class TMutationStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TMutationStandardScheme getScheme() { return new TMutationStandardScheme(); } } - private static class TMutationStandardScheme extends StandardScheme<TMutation> { + private static class TMutationStandardScheme extends org.apache.thrift.scheme.StandardScheme<TMutation> { public void read(org.apache.thrift.protocol.TProtocol iprot, TMutation struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; @@ -747,8 +720,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); - struct.values = new ArrayList<ByteBuffer>(_list0.size); - ByteBuffer _elem1; + struct.values = new java.util.ArrayList<java.nio.ByteBuffer>(_list0.size); + java.nio.ByteBuffer _elem1; for (int _i2 = 0; _i2 < _list0.size; ++_i2) { _elem1 = iprot.readBinary(); @@ -773,8 +746,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list3 = iprot.readListBegin(); - struct.sources = new ArrayList<String>(_list3.size); - String _elem4; + struct.sources = new java.util.ArrayList<java.lang.String>(_list3.size); + java.lang.String _elem4; for (int _i5 = 0; _i5 < _list3.size; ++_i5) { _elem4 = iprot.readString(); @@ -816,7 +789,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ oprot.writeFieldBegin(VALUES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.values.size())); - for (ByteBuffer _iter6 : struct.values) + for (java.nio.ByteBuffer _iter6 : struct.values) { oprot.writeBinary(_iter6); } @@ -832,7 +805,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ oprot.writeFieldBegin(SOURCES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.sources.size())); - for (String _iter7 : struct.sources) + for (java.lang.String _iter7 : struct.sources) { oprot.writeString(_iter7); } @@ -847,18 +820,18 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } - private static class TMutationTupleSchemeFactory implements SchemeFactory { + private static class TMutationTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory { public TMutationTupleScheme getScheme() { return new TMutationTupleScheme(); } } - private static class TMutationTupleScheme extends TupleScheme<TMutation> { + private static class TMutationTupleScheme extends org.apache.thrift.scheme.TupleScheme<TMutation> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TMutation struct) throws org.apache.thrift.TException { - TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); + org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetRow()) { optionals.set(0); } @@ -884,7 +857,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (struct.isSetValues()) { { oprot.writeI32(struct.values.size()); - for (ByteBuffer _iter8 : struct.values) + for (java.nio.ByteBuffer _iter8 : struct.values) { oprot.writeBinary(_iter8); } @@ -896,7 +869,7 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (struct.isSetSources()) { { oprot.writeI32(struct.sources.size()); - for (String _iter9 : struct.sources) + for (java.lang.String _iter9 : struct.sources) { oprot.writeString(_iter9); } @@ -906,8 +879,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ @Override public void read(org.apache.thrift.protocol.TProtocol prot, TMutation struct) throws org.apache.thrift.TException { - TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(5); + org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; + java.util.BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.row = iprot.readBinary(); struct.setRowIsSet(true); @@ -919,8 +892,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (incoming.get(2)) { { org.apache.thrift.protocol.TList _list10 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.values = new ArrayList<ByteBuffer>(_list10.size); - ByteBuffer _elem11; + struct.values = new java.util.ArrayList<java.nio.ByteBuffer>(_list10.size); + java.nio.ByteBuffer _elem11; for (int _i12 = 0; _i12 < _list10.size; ++_i12) { _elem11 = iprot.readBinary(); @@ -936,8 +909,8 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ if (incoming.get(4)) { { org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.sources = new ArrayList<String>(_list13.size); - String _elem14; + struct.sources = new java.util.ArrayList<java.lang.String>(_list13.size); + java.lang.String _elem14; for (int _i15 = 0; _i15 < _list13.size; ++_i15) { _elem14 = iprot.readString(); @@ -949,5 +922,9 @@ public class TMutation implements org.apache.thrift.TBase<TMutation, TMutation._ } } + private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) { + return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme(); + } + private static void unusedMethod() {} }