hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r901398 [3/3] - in /hadoop/hbase/trunk: ./ lib/ src/java/org/apache/hadoop/hbase/thrift/ src/java/org/apache/hadoop/hbase/thrift/generated/
Date Wed, 20 Jan 2010 22:04:38 GMT
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,9 +17,20 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
@@ -32,16 +41,72 @@
  * to the Hbase master or an Hbase region server.  Also used to return
  * more general Hbase error conditions.
  */
-public class IOError extends Exception implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class IOError extends Exception implements TBase<IOError._Fields>, java.io.Serializable, Cloneable, Comparable<IOError> {
   private static final TStruct STRUCT_DESC = new TStruct("IOError");
+
   private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
 
   public String message;
-  public static final int MESSAGE = 1;
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
   }});
 
@@ -68,7 +133,11 @@
     }
   }
 
-  @Override
+  public IOError deepCopy() {
+    return new IOError(this);
+  }
+
+  @Deprecated
   public IOError clone() {
     return new IOError(this);
   }
@@ -77,15 +146,16 @@
     return this.message;
   }
 
-  public void setMessage(String message) {
+  public IOError setMessage(String message) {
     this.message = message;
+    return this;
   }
 
   public void unsetMessage() {
     this.message = null;
   }
 
-  // Returns true if field message is set (has been asigned a value) and false otherwise
+  /** Returns true if field message is set (has been asigned a value) and false otherwise */
   public boolean isSetMessage() {
     return this.message != null;
   }
@@ -96,8 +166,8 @@
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
     case MESSAGE:
       if (value == null) {
         unsetMessage();
@@ -106,29 +176,37 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
     case MESSAGE:
       return getMessage();
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
+  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) {
+    switch (field) {
     case MESSAGE:
       return isSetMessage();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -158,6 +236,32 @@
 
   @Override
   public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_message = true && (isSetMessage());
+    builder.append(present_message);
+    if (present_message)
+      builder.append(message);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(IOError other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    IOError typedOther = (IOError)other;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
     return 0;
   }
 
@@ -170,24 +274,24 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case MESSAGE:
-          if (field.type == TType.STRING) {
-            this.message = iprot.readString();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case MESSAGE:
+            if (field.type == TType.STRING) {
+              this.message = iprot.readString();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -208,6 +312,7 @@
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder("IOError(");
+    boolean first = true;
 
     sb.append("message:");
     if (this.message == null) {
@@ -215,13 +320,13 @@
     } else {
       sb.append(this.message);
     }
+    first = false;
     sb.append(")");
     return sb.toString();
   }
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,9 +17,20 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
@@ -31,16 +40,72 @@
  * An IllegalArgument exception indicates an illegal or invalid
  * argument was passed into a procedure.
  */
-public class IllegalArgument extends Exception implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class IllegalArgument extends Exception implements TBase<IllegalArgument._Fields>, java.io.Serializable, Cloneable, Comparable<IllegalArgument> {
   private static final TStruct STRUCT_DESC = new TStruct("IllegalArgument");
+
   private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
 
   public String message;
-  public static final int MESSAGE = 1;
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
   }});
 
@@ -67,7 +132,11 @@
     }
   }
 
-  @Override
+  public IllegalArgument deepCopy() {
+    return new IllegalArgument(this);
+  }
+
+  @Deprecated
   public IllegalArgument clone() {
     return new IllegalArgument(this);
   }
@@ -76,15 +145,16 @@
     return this.message;
   }
 
-  public void setMessage(String message) {
+  public IllegalArgument setMessage(String message) {
     this.message = message;
+    return this;
   }
 
   public void unsetMessage() {
     this.message = null;
   }
 
-  // Returns true if field message is set (has been asigned a value) and false otherwise
+  /** Returns true if field message is set (has been asigned a value) and false otherwise */
   public boolean isSetMessage() {
     return this.message != null;
   }
@@ -95,8 +165,8 @@
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
     case MESSAGE:
       if (value == null) {
         unsetMessage();
@@ -105,29 +175,37 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
     case MESSAGE:
       return getMessage();
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
+  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) {
+    switch (field) {
     case MESSAGE:
       return isSetMessage();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -157,6 +235,32 @@
 
   @Override
   public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_message = true && (isSetMessage());
+    builder.append(present_message);
+    if (present_message)
+      builder.append(message);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(IllegalArgument other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    IllegalArgument typedOther = (IllegalArgument)other;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
     return 0;
   }
 
@@ -169,24 +273,24 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case MESSAGE:
-          if (field.type == TType.STRING) {
-            this.message = iprot.readString();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case MESSAGE:
+            if (field.type == TType.STRING) {
+              this.message = iprot.readString();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -207,6 +311,7 @@
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder("IllegalArgument(");
+    boolean first = true;
 
     sb.append("message:");
     if (this.message == null) {
@@ -214,13 +319,13 @@
     } else {
       sb.append(this.message);
     }
+    first = false;
     sb.append(")");
     return sb.toString();
   }
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,11 +17,21 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.protocol.*;
@@ -31,32 +39,84 @@
 /**
  * A Mutation object is used to either update or delete a column-value.
  */
-public class Mutation implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class Mutation implements TBase<Mutation._Fields>, java.io.Serializable, Cloneable, Comparable<Mutation> {
   private static final TStruct STRUCT_DESC = new TStruct("Mutation");
+
   private static final TField IS_DELETE_FIELD_DESC = new TField("isDelete", TType.BOOL, (short)1);
   private static final TField COLUMN_FIELD_DESC = new TField("column", TType.STRING, (short)2);
   private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)3);
 
   public boolean isDelete;
-  public static final int ISDELETE = 1;
   public byte[] column;
-  public static final int COLUMN = 2;
   public byte[] value;
-  public static final int VALUE = 3;
 
-  private final Isset __isset = new Isset();
-  private static final class Isset implements java.io.Serializable {
-    private static final long serialVersionUID = 1L;
-    public boolean isDelete = false;
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    IS_DELETE((short)1, "isDelete"),
+    COLUMN((short)2, "column"),
+    VALUE((short)3, "value");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
   }
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(ISDELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT, 
+  // isset id assignments
+  private static final int __ISDELETE_ISSET_ID = 0;
+  private BitSet __isset_bit_vector = new BitSet(1);
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.IS_DELETE, new FieldMetaData("isDelete", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.BOOL)));
-    put(COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT, 
+    put(_Fields.COLUMN, new FieldMetaData("column", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT, 
+    put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
   }});
 
@@ -76,7 +136,7 @@
   {
     this();
     this.isDelete = isDelete;
-    this.__isset.isDelete = true;
+    setIsDeleteIsSet(true);
     this.column = column;
     this.value = value;
   }
@@ -85,7 +145,8 @@
    * Performs a deep copy on <i>other</i>.
    */
   public Mutation(Mutation other) {
-    __isset.isDelete = other.__isset.isDelete;
+    __isset_bit_vector.clear();
+    __isset_bit_vector.or(other.__isset_bit_vector);
     this.isDelete = other.isDelete;
     if (other.isSetColumn()) {
       this.column = other.column;
@@ -95,7 +156,11 @@
     }
   }
 
-  @Override
+  public Mutation deepCopy() {
+    return new Mutation(this);
+  }
+
+  @Deprecated
   public Mutation clone() {
     return new Mutation(this);
   }
@@ -104,37 +169,39 @@
     return this.isDelete;
   }
 
-  public void setIsDelete(boolean isDelete) {
+  public Mutation setIsDelete(boolean isDelete) {
     this.isDelete = isDelete;
-    this.__isset.isDelete = true;
+    setIsDeleteIsSet(true);
+    return this;
   }
 
   public void unsetIsDelete() {
-    this.__isset.isDelete = false;
+    __isset_bit_vector.clear(__ISDELETE_ISSET_ID);
   }
 
-  // Returns true if field isDelete is set (has been asigned a value) and false otherwise
+  /** Returns true if field isDelete is set (has been asigned a value) and false otherwise */
   public boolean isSetIsDelete() {
-    return this.__isset.isDelete;
+    return __isset_bit_vector.get(__ISDELETE_ISSET_ID);
   }
 
   public void setIsDeleteIsSet(boolean value) {
-    this.__isset.isDelete = value;
+    __isset_bit_vector.set(__ISDELETE_ISSET_ID, value);
   }
 
   public byte[] getColumn() {
     return this.column;
   }
 
-  public void setColumn(byte[] column) {
+  public Mutation setColumn(byte[] column) {
     this.column = column;
+    return this;
   }
 
   public void unsetColumn() {
     this.column = null;
   }
 
-  // Returns true if field column is set (has been asigned a value) and false otherwise
+  /** Returns true if field column is set (has been asigned a value) and false otherwise */
   public boolean isSetColumn() {
     return this.column != null;
   }
@@ -149,15 +216,16 @@
     return this.value;
   }
 
-  public void setValue(byte[] value) {
+  public Mutation setValue(byte[] value) {
     this.value = value;
+    return this;
   }
 
   public void unsetValue() {
     this.value = null;
   }
 
-  // Returns true if field value is set (has been asigned a value) and false otherwise
+  /** Returns true if field value is set (has been asigned a value) and false otherwise */
   public boolean isSetValue() {
     return this.value != null;
   }
@@ -168,9 +236,9 @@
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
-    case ISDELETE:
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case IS_DELETE:
       if (value == null) {
         unsetIsDelete();
       } else {
@@ -194,15 +262,17 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
-    case ISDELETE:
-      return Boolean.valueOf(isIsDelete());
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case IS_DELETE:
+      return new Boolean(isIsDelete());
 
     case COLUMN:
       return getColumn();
@@ -210,23 +280,29 @@
     case VALUE:
       return getValue();
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
-    case ISDELETE:
+  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) {
+    switch (field) {
+    case IS_DELETE:
       return isSetIsDelete();
     case COLUMN:
       return isSetColumn();
     case VALUE:
       return isSetValue();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -274,6 +350,58 @@
 
   @Override
   public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_isDelete = true;
+    builder.append(present_isDelete);
+    if (present_isDelete)
+      builder.append(isDelete);
+
+    boolean present_column = true && (isSetColumn());
+    builder.append(present_column);
+    if (present_column)
+      builder.append(column);
+
+    boolean present_value = true && (isSetValue());
+    builder.append(present_value);
+    if (present_value)
+      builder.append(value);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(Mutation other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    Mutation typedOther = (Mutation)other;
+
+    lastComparison = Boolean.valueOf(isSetIsDelete()).compareTo(isSetIsDelete());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(isDelete, typedOther.isDelete);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetColumn()).compareTo(isSetColumn());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(column, typedOther.column);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(value, typedOther.value);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
     return 0;
   }
 
@@ -286,39 +414,39 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case ISDELETE:
-          if (field.type == TType.BOOL) {
-            this.isDelete = iprot.readBool();
-            this.__isset.isDelete = true;
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case COLUMN:
-          if (field.type == TType.STRING) {
-            this.column = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case VALUE:
-          if (field.type == TType.STRING) {
-            this.value = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case IS_DELETE:
+            if (field.type == TType.BOOL) {
+              this.isDelete = iprot.readBool();
+              setIsDeleteIsSet(true);
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case COLUMN:
+            if (field.type == TType.STRING) {
+              this.column = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case VALUE:
+            if (field.type == TType.STRING) {
+              this.value = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -357,7 +485,7 @@
     if (this.column == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.column));
+      sb.append(this.column);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -365,7 +493,7 @@
     if (this.value == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.value));
+      sb.append(this.value);
     }
     first = false;
     sb.append(")");
@@ -374,7 +502,6 @@
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TCell.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,11 +17,21 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.protocol.*;
@@ -34,27 +42,79 @@
  * the timestamp of a cell to a first-class value, making it easy to take
  * note of temporal data. Cell is used all the way from HStore up to HTable.
  */
-public class TCell implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class TCell implements TBase<TCell._Fields>, java.io.Serializable, Cloneable, Comparable<TCell> {
   private static final TStruct STRUCT_DESC = new TStruct("TCell");
+
   private static final TField VALUE_FIELD_DESC = new TField("value", TType.STRING, (short)1);
   private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)2);
 
   public byte[] value;
-  public static final int VALUE = 1;
   public long timestamp;
-  public static final int TIMESTAMP = 2;
 
-  private final Isset __isset = new Isset();
-  private static final class Isset implements java.io.Serializable {
-    private static final long serialVersionUID = 1L;
-    public boolean timestamp = false;
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    VALUE((short)1, "value"),
+    TIMESTAMP((short)2, "timestamp");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
   }
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT, 
+  // isset id assignments
+  private static final int __TIMESTAMP_ISSET_ID = 0;
+  private BitSet __isset_bit_vector = new BitSet(1);
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.VALUE, new FieldMetaData("value", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
+    put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.I64)));
   }});
 
@@ -72,21 +132,26 @@
     this();
     this.value = value;
     this.timestamp = timestamp;
-    this.__isset.timestamp = true;
+    setTimestampIsSet(true);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public TCell(TCell other) {
+    __isset_bit_vector.clear();
+    __isset_bit_vector.or(other.__isset_bit_vector);
     if (other.isSetValue()) {
       this.value = other.value;
     }
-    __isset.timestamp = other.__isset.timestamp;
     this.timestamp = other.timestamp;
   }
 
-  @Override
+  public TCell deepCopy() {
+    return new TCell(this);
+  }
+
+  @Deprecated
   public TCell clone() {
     return new TCell(this);
   }
@@ -95,15 +160,16 @@
     return this.value;
   }
 
-  public void setValue(byte[] value) {
+  public TCell setValue(byte[] value) {
     this.value = value;
+    return this;
   }
 
   public void unsetValue() {
     this.value = null;
   }
 
-  // Returns true if field value is set (has been asigned a value) and false otherwise
+  /** Returns true if field value is set (has been asigned a value) and false otherwise */
   public boolean isSetValue() {
     return this.value != null;
   }
@@ -118,26 +184,27 @@
     return this.timestamp;
   }
 
-  public void setTimestamp(long timestamp) {
+  public TCell setTimestamp(long timestamp) {
     this.timestamp = timestamp;
-    this.__isset.timestamp = true;
+    setTimestampIsSet(true);
+    return this;
   }
 
   public void unsetTimestamp() {
-    this.__isset.timestamp = false;
+    __isset_bit_vector.clear(__TIMESTAMP_ISSET_ID);
   }
 
-  // Returns true if field timestamp is set (has been asigned a value) and false otherwise
+  /** Returns true if field timestamp is set (has been asigned a value) and false otherwise */
   public boolean isSetTimestamp() {
-    return this.__isset.timestamp;
+    return __isset_bit_vector.get(__TIMESTAMP_ISSET_ID);
   }
 
   public void setTimestampIsSet(boolean value) {
-    this.__isset.timestamp = value;
+    __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
     case VALUE:
       if (value == null) {
         unsetValue();
@@ -154,34 +221,42 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
     case VALUE:
       return getValue();
 
     case TIMESTAMP:
-      return getTimestamp();
+      return new Long(getTimestamp());
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
+  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) {
+    switch (field) {
     case VALUE:
       return isSetValue();
     case TIMESTAMP:
       return isSetTimestamp();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -220,6 +295,45 @@
 
   @Override
   public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_value = true && (isSetValue());
+    builder.append(present_value);
+    if (present_value)
+      builder.append(value);
+
+    boolean present_timestamp = true;
+    builder.append(present_timestamp);
+    if (present_timestamp)
+      builder.append(timestamp);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(TCell other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    TCell typedOther = (TCell)other;
+
+    lastComparison = Boolean.valueOf(isSetValue()).compareTo(isSetValue());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(value, typedOther.value);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(isSetTimestamp());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
     return 0;
   }
 
@@ -232,32 +346,32 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case VALUE:
-          if (field.type == TType.STRING) {
-            this.value = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case TIMESTAMP:
-          if (field.type == TType.I64) {
-            this.timestamp = iprot.readI64();
-            this.__isset.timestamp = true;
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case VALUE:
+            if (field.type == TType.STRING) {
+              this.value = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case TIMESTAMP:
+            if (field.type == TType.I64) {
+              this.timestamp = iprot.readI64();
+              setTimestampIsSet(true);
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -287,7 +401,7 @@
     if (this.value == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.value));
+      sb.append(this.value);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -300,7 +414,6 @@
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRegionInfo.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,11 +17,21 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.protocol.*;
@@ -31,9 +39,9 @@
 /**
  * A TRegionInfo contains information about an HTable region.
  */
-public class TRegionInfo implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class TRegionInfo implements TBase<TRegionInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TRegionInfo> {
   private static final TStruct STRUCT_DESC = new TStruct("TRegionInfo");
+
   private static final TField START_KEY_FIELD_DESC = new TField("startKey", TType.STRING, (short)1);
   private static final TField END_KEY_FIELD_DESC = new TField("endKey", TType.STRING, (short)2);
   private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)3);
@@ -41,33 +49,85 @@
   private static final TField VERSION_FIELD_DESC = new TField("version", TType.BYTE, (short)5);
 
   public byte[] startKey;
-  public static final int STARTKEY = 1;
   public byte[] endKey;
-  public static final int ENDKEY = 2;
   public long id;
-  public static final int ID = 3;
   public byte[] name;
-  public static final int NAME = 4;
   public byte version;
-  public static final int VERSION = 5;
 
-  private final Isset __isset = new Isset();
-  private static final class Isset implements java.io.Serializable {
-    private static final long serialVersionUID = 1L;
-    public boolean id = false;
-    public boolean version = false;
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    START_KEY((short)1, "startKey"),
+    END_KEY((short)2, "endKey"),
+    ID((short)3, "id"),
+    NAME((short)4, "name"),
+    VERSION((short)5, "version");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
   }
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(STARTKEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT, 
+  // isset id assignments
+  private static final int __ID_ISSET_ID = 0;
+  private static final int __VERSION_ISSET_ID = 1;
+  private BitSet __isset_bit_vector = new BitSet(2);
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.START_KEY, new FieldMetaData("startKey", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(ENDKEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT, 
+    put(_Fields.END_KEY, new FieldMetaData("endKey", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
+    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.I64)));
-    put(NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
+    put(_Fields.NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT, 
+    put(_Fields.VERSION, new FieldMetaData("version", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.BYTE)));
   }});
 
@@ -89,32 +149,36 @@
     this.startKey = startKey;
     this.endKey = endKey;
     this.id = id;
-    this.__isset.id = true;
+    setIdIsSet(true);
     this.name = name;
     this.version = version;
-    this.__isset.version = true;
+    setVersionIsSet(true);
   }
 
   /**
    * Performs a deep copy on <i>other</i>.
    */
   public TRegionInfo(TRegionInfo other) {
+    __isset_bit_vector.clear();
+    __isset_bit_vector.or(other.__isset_bit_vector);
     if (other.isSetStartKey()) {
       this.startKey = other.startKey;
     }
     if (other.isSetEndKey()) {
       this.endKey = other.endKey;
     }
-    __isset.id = other.__isset.id;
     this.id = other.id;
     if (other.isSetName()) {
       this.name = other.name;
     }
-    __isset.version = other.__isset.version;
     this.version = other.version;
   }
 
-  @Override
+  public TRegionInfo deepCopy() {
+    return new TRegionInfo(this);
+  }
+
+  @Deprecated
   public TRegionInfo clone() {
     return new TRegionInfo(this);
   }
@@ -123,15 +187,16 @@
     return this.startKey;
   }
 
-  public void setStartKey(byte[] startKey) {
+  public TRegionInfo setStartKey(byte[] startKey) {
     this.startKey = startKey;
+    return this;
   }
 
   public void unsetStartKey() {
     this.startKey = null;
   }
 
-  // Returns true if field startKey is set (has been asigned a value) and false otherwise
+  /** Returns true if field startKey is set (has been asigned a value) and false otherwise */
   public boolean isSetStartKey() {
     return this.startKey != null;
   }
@@ -146,15 +211,16 @@
     return this.endKey;
   }
 
-  public void setEndKey(byte[] endKey) {
+  public TRegionInfo setEndKey(byte[] endKey) {
     this.endKey = endKey;
+    return this;
   }
 
   public void unsetEndKey() {
     this.endKey = null;
   }
 
-  // Returns true if field endKey is set (has been asigned a value) and false otherwise
+  /** Returns true if field endKey is set (has been asigned a value) and false otherwise */
   public boolean isSetEndKey() {
     return this.endKey != null;
   }
@@ -169,37 +235,39 @@
     return this.id;
   }
 
-  public void setId(long id) {
+  public TRegionInfo setId(long id) {
     this.id = id;
-    this.__isset.id = true;
+    setIdIsSet(true);
+    return this;
   }
 
   public void unsetId() {
-    this.__isset.id = false;
+    __isset_bit_vector.clear(__ID_ISSET_ID);
   }
 
-  // Returns true if field id is set (has been asigned a value) and false otherwise
+  /** Returns true if field id is set (has been asigned a value) and false otherwise */
   public boolean isSetId() {
-    return this.__isset.id;
+    return __isset_bit_vector.get(__ID_ISSET_ID);
   }
 
   public void setIdIsSet(boolean value) {
-    this.__isset.id = value;
+    __isset_bit_vector.set(__ID_ISSET_ID, value);
   }
 
   public byte[] getName() {
     return this.name;
   }
 
-  public void setName(byte[] name) {
+  public TRegionInfo setName(byte[] name) {
     this.name = name;
+    return this;
   }
 
   public void unsetName() {
     this.name = null;
   }
 
-  // Returns true if field name is set (has been asigned a value) and false otherwise
+  /** Returns true if field name is set (has been asigned a value) and false otherwise */
   public boolean isSetName() {
     return this.name != null;
   }
@@ -214,27 +282,28 @@
     return this.version;
   }
 
-  public void setVersion(byte version) {
+  public TRegionInfo setVersion(byte version) {
     this.version = version;
-    this.__isset.version = true;
+    setVersionIsSet(true);
+    return this;
   }
 
   public void unsetVersion() {
-    this.__isset.version = false;
+    __isset_bit_vector.clear(__VERSION_ISSET_ID);
   }
 
-  // Returns true if field version is set (has been asigned a value) and false otherwise
+  /** Returns true if field version is set (has been asigned a value) and false otherwise */
   public boolean isSetVersion() {
-    return this.__isset.version;
+    return __isset_bit_vector.get(__VERSION_ISSET_ID);
   }
 
   public void setVersionIsSet(boolean value) {
-    this.__isset.version = value;
+    __isset_bit_vector.set(__VERSION_ISSET_ID, value);
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
-    case STARTKEY:
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case START_KEY:
       if (value == null) {
         unsetStartKey();
       } else {
@@ -242,7 +311,7 @@
       }
       break;
 
-    case ENDKEY:
+    case END_KEY:
       if (value == null) {
         unsetEndKey();
       } else {
@@ -274,39 +343,44 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
-    case STARTKEY:
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case START_KEY:
       return getStartKey();
 
-    case ENDKEY:
+    case END_KEY:
       return getEndKey();
 
     case ID:
-      return getId();
+      return new Long(getId());
 
     case NAME:
       return getName();
 
     case VERSION:
-      return getVersion();
+      return new Byte(getVersion());
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
-    case STARTKEY:
+  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) {
+    switch (field) {
+    case START_KEY:
       return isSetStartKey();
-    case ENDKEY:
+    case END_KEY:
       return isSetEndKey();
     case ID:
       return isSetId();
@@ -314,9 +388,12 @@
       return isSetName();
     case VERSION:
       return isSetVersion();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -382,6 +459,84 @@
 
   @Override
   public int hashCode() {
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_startKey = true && (isSetStartKey());
+    builder.append(present_startKey);
+    if (present_startKey)
+      builder.append(startKey);
+
+    boolean present_endKey = true && (isSetEndKey());
+    builder.append(present_endKey);
+    if (present_endKey)
+      builder.append(endKey);
+
+    boolean present_id = true;
+    builder.append(present_id);
+    if (present_id)
+      builder.append(id);
+
+    boolean present_name = true && (isSetName());
+    builder.append(present_name);
+    if (present_name)
+      builder.append(name);
+
+    boolean present_version = true;
+    builder.append(present_version);
+    if (present_version)
+      builder.append(version);
+
+    return builder.toHashCode();
+  }
+
+  public int compareTo(TRegionInfo other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    TRegionInfo typedOther = (TRegionInfo)other;
+
+    lastComparison = Boolean.valueOf(isSetStartKey()).compareTo(isSetStartKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(startKey, typedOther.startKey);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetEndKey()).compareTo(isSetEndKey());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(endKey, typedOther.endKey);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetName()).compareTo(isSetName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(name, typedOther.name);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(isSetVersion());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    lastComparison = TBaseHelper.compareTo(version, typedOther.version);
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
     return 0;
   }
 
@@ -394,54 +549,54 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case STARTKEY:
-          if (field.type == TType.STRING) {
-            this.startKey = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case ENDKEY:
-          if (field.type == TType.STRING) {
-            this.endKey = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case ID:
-          if (field.type == TType.I64) {
-            this.id = iprot.readI64();
-            this.__isset.id = true;
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case NAME:
-          if (field.type == TType.STRING) {
-            this.name = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case VERSION:
-          if (field.type == TType.BYTE) {
-            this.version = iprot.readByte();
-            this.__isset.version = true;
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case START_KEY:
+            if (field.type == TType.STRING) {
+              this.startKey = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case END_KEY:
+            if (field.type == TType.STRING) {
+              this.endKey = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case ID:
+            if (field.type == TType.I64) {
+              this.id = iprot.readI64();
+              setIdIsSet(true);
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case NAME:
+            if (field.type == TType.STRING) {
+              this.name = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case VERSION:
+            if (field.type == TType.BYTE) {
+              this.version = iprot.readByte();
+              setVersionIsSet(true);
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -484,7 +639,7 @@
     if (this.startKey == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.startKey));
+      sb.append(this.startKey);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -492,7 +647,7 @@
     if (this.endKey == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.endKey));
+      sb.append(this.endKey);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -504,7 +659,7 @@
     if (this.name == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.name));
+      sb.append(this.name);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -517,7 +672,6 @@
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java Wed Jan 20 22:04:37 2010
@@ -1,6 +1,4 @@
-/*
- * Copyright 2009 The Apache Software Foundation
- *
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,11 +17,21 @@
  */
 package org.apache.hadoop.hbase.thrift.generated;
 
+import org.apache.commons.lang.builder.HashCodeBuilder;
+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.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.thrift.*;
 import org.apache.thrift.meta_data.*;
 import org.apache.thrift.protocol.*;
@@ -31,21 +39,77 @@
 /**
  * Holds row name and then a map of columns to cells.
  */
-public class TRowResult implements TBase, java.io.Serializable, Cloneable {
-  private static final long serialVersionUID = 1L;
+public class TRowResult implements TBase<TRowResult._Fields>, java.io.Serializable, Cloneable {
   private static final TStruct STRUCT_DESC = new TStruct("TRowResult");
+
   private static final TField ROW_FIELD_DESC = new TField("row", TType.STRING, (short)1);
   private static final TField COLUMNS_FIELD_DESC = new TField("columns", TType.MAP, (short)2);
 
   public byte[] row;
-  public static final int ROW = 1;
   public Map<byte[],TCell> columns;
-  public static final int COLUMNS = 2;
 
-  public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
-    put(ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT, 
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements TFieldIdEnum {
+    ROW((short)1, "row"),
+    COLUMNS((short)2, "columns");
+
+    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byId.put((int)field._thriftId, field);
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      return byId.get(fieldId);
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new 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) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+
+  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
+    put(_Fields.ROW, new FieldMetaData("row", TFieldRequirementType.DEFAULT, 
         new FieldValueMetaData(TType.STRING)));
-    put(COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT, 
+    put(_Fields.COLUMNS, new FieldMetaData("columns", TFieldRequirementType.DEFAULT, 
         new MapMetaData(TType.MAP, 
             new FieldValueMetaData(TType.STRING), 
             new StructMetaData(TType.STRUCT, TCell.class))));
@@ -91,7 +155,11 @@
     }
   }
 
-  @Override
+  public TRowResult deepCopy() {
+    return new TRowResult(this);
+  }
+
+  @Deprecated
   public TRowResult clone() {
     return new TRowResult(this);
   }
@@ -100,15 +168,16 @@
     return this.row;
   }
 
-  public void setRow(byte[] row) {
+  public TRowResult setRow(byte[] row) {
     this.row = row;
+    return this;
   }
 
   public void unsetRow() {
     this.row = null;
   }
 
-  // Returns true if field row is set (has been asigned a value) and false otherwise
+  /** Returns true if field row is set (has been asigned a value) and false otherwise */
   public boolean isSetRow() {
     return this.row != null;
   }
@@ -134,15 +203,16 @@
     return this.columns;
   }
 
-  public void setColumns(Map<byte[],TCell> columns) {
+  public TRowResult setColumns(Map<byte[],TCell> columns) {
     this.columns = columns;
+    return this;
   }
 
   public void unsetColumns() {
     this.columns = null;
   }
 
-  // Returns true if field columns is set (has been asigned a value) and false otherwise
+  /** Returns true if field columns is set (has been asigned a value) and false otherwise */
   public boolean isSetColumns() {
     return this.columns != null;
   }
@@ -153,8 +223,8 @@
     }
   }
 
-  public void setFieldValue(int fieldID, Object value) {
-    switch (fieldID) {
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
     case ROW:
       if (value == null) {
         unsetRow();
@@ -171,34 +241,42 @@
       }
       break;
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
   }
 
-  public Object getFieldValue(int fieldID) {
-    switch (fieldID) {
+  public void setFieldValue(int fieldID, Object value) {
+    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
     case ROW:
       return getRow();
 
     case COLUMNS:
       return getColumns();
 
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
   }
 
-  // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
-  public boolean isSet(int fieldID) {
-    switch (fieldID) {
+  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) {
+    switch (field) {
     case ROW:
       return isSetRow();
     case COLUMNS:
       return isSetColumns();
-    default:
-      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
     }
+    throw new IllegalStateException();
+  }
+
+  public boolean isSet(int fieldID) {
+    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
   }
 
   @Override
@@ -237,7 +315,19 @@
 
   @Override
   public int hashCode() {
-    return 0;
+    HashCodeBuilder builder = new HashCodeBuilder();
+
+    boolean present_row = true && (isSetRow());
+    builder.append(present_row);
+    if (present_row)
+      builder.append(row);
+
+    boolean present_columns = true && (isSetColumns());
+    builder.append(present_columns);
+    if (present_columns)
+      builder.append(columns);
+
+    return builder.toHashCode();
   }
 
   public void read(TProtocol iprot) throws TException {
@@ -249,44 +339,44 @@
       if (field.type == TType.STOP) { 
         break;
       }
-      switch (field.id)
-      {
-        case ROW:
-          if (field.type == TType.STRING) {
-            this.row = iprot.readBinary();
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        case COLUMNS:
-          if (field.type == TType.MAP) {
-            {
-              TMap _map4 = iprot.readMapBegin();
-              this.columns = new HashMap<byte[],TCell>(2*_map4.size);
-              for (int _i5 = 0; _i5 < _map4.size; ++_i5)
+      _Fields fieldId = _Fields.findByThriftId(field.id);
+      if (fieldId == null) {
+        TProtocolUtil.skip(iprot, field.type);
+      } else {
+        switch (fieldId) {
+          case ROW:
+            if (field.type == TType.STRING) {
+              this.row = iprot.readBinary();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
+            }
+            break;
+          case COLUMNS:
+            if (field.type == TType.MAP) {
               {
-                byte[] _key6;
-                TCell _val7;
-                _key6 = iprot.readBinary();
-                _val7 = new TCell();
-                _val7.read(iprot);
-                this.columns.put(_key6, _val7);
+                TMap _map4 = iprot.readMapBegin();
+                this.columns = new HashMap<byte[],TCell>(2*_map4.size);
+                for (int _i5 = 0; _i5 < _map4.size; ++_i5)
+                {
+                  byte[] _key6;
+                  TCell _val7;
+                  _key6 = iprot.readBinary();
+                  _val7 = new TCell();
+                  _val7.read(iprot);
+                  this.columns.put(_key6, _val7);
+                }
+                iprot.readMapEnd();
               }
-              iprot.readMapEnd();
+            } else { 
+              TProtocolUtil.skip(iprot, field.type);
             }
-          } else { 
-            TProtocolUtil.skip(iprot, field.type);
-          }
-          break;
-        default:
-          TProtocolUtil.skip(iprot, field.type);
-          break;
+            break;
+        }
+        iprot.readFieldEnd();
       }
-      iprot.readFieldEnd();
     }
     iprot.readStructEnd();
 
-
     // check for required fields of primitive type, which can't be checked in the validate method
     validate();
   }
@@ -304,7 +394,8 @@
       oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
       {
         oprot.writeMapBegin(new TMap(TType.STRING, TType.STRUCT, this.columns.size()));
-        for (Map.Entry<byte[], TCell> _iter8 : this.columns.entrySet())        {
+        for (Map.Entry<byte[], TCell> _iter8 : this.columns.entrySet())
+        {
           oprot.writeBinary(_iter8.getKey());
           _iter8.getValue().write(oprot);
         }
@@ -325,7 +416,7 @@
     if (this.row == null) {
       sb.append("null");
     } else {
-      sb.append(Bytes.toStringBinary(this.row));
+      sb.append(this.row);
     }
     first = false;
     if (!first) sb.append(", ");
@@ -342,7 +433,6 @@
 
   public void validate() throws TException {
     // check for required fields
-    // check that fields of type enum have valid values
   }
 
 }

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html?rev=901398&r1=901397&r2=901398&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/thrift/package.html Wed Jan 20 22:04:37 2010
@@ -20,28 +20,23 @@
 
 <head />
 <body bgcolor="white">
-Provides an HBase <a href="http://developers.facebook.com/thrift/">Thrift</a>
+Provides an HBase <a href="http://incubator.apache.org/thrift/">Thrift</a>
 service.
 
 This directory contains a Thrift interface definition file for an Hbase RPC
 service and a Java server implementation.
 
 <h2><a name="whatisthrift">What is Thrift?</a></h2> 
-
-<p>"Thrift is a software framework for scalable cross-language services
-development. It combines a powerful software stack with a code generation
-engine to build services that work efficiently and seamlessly between C++,
-Java, Python, PHP, and Ruby. Thrift was developed at Facebook, and we are now
-releasing it as open source."  For additional information, see
-http://developers.facebook.com/thrift/.  Facebook has announced their intent
-to migrate Thrift into Apache Incubator.
-</p>
+<p><blockquote>"Thrift is a software framework for scalable cross-language services development.
+It combines a software stack with a code generation engine to build services
+that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby,
+Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml."</blockquote></p>
 
 <h2><a name="description">Description</a></h2>
 
 <p>The <a href="generated/Hbase.Iface.html">Hbase API</a> is defined in the
 file Hbase.thrift.  A server-side implementation of the API is in
-<code>org.apache.hadoop.hbase.thrift.ThriftServer</code>.  The generated interfaces,
+<code>org.apache.hadoop.hbase.thrift.ThriftServer</code>. The generated interfaces,
 types, and RPC utility files are checked into SVN under the
 <code>org.apache.hadoop.hbase.thrift.generated</code> directory.
 
@@ -49,16 +44,15 @@
 
 <p>The files were generated by running the commands:
 <pre>
-  thrift -strict --gen java Hbase.thrift
+  thrift -strict --gen java:hashcode Hbase.thrift
   mv gen-java/org/apache/hadoop/hbase/thrift/generated .
   rm -rf gen-java
 </pre>
 </p>
 
 <p>The 'thrift' binary is the Thrift compiler, and it is distributed as a part
-of
-the Thrift package.  Additionally, specific language runtime libraries are a
-part of the Thrift package.  A version of the Java runtime is checked into SVN
+of the Thrift package.  Additionally, specific language runtime libraries are a
+part of the Thrift package. A version of the Java runtime is checked into SVN
 under the hbase/lib directory.
 </p>
 



Mime
View raw message