avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1078919 - in /avro/branches/branch-1.5: ./ CHANGES.txt lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
Date Mon, 07 Mar 2011 20:15:22 GMT
Author: cutting
Date: Mon Mar  7 20:15:21 2011
New Revision: 1078919

URL: http://svn.apache.org/viewvc?rev=1078919&view=rev
Log:
Merge -c 1078917 from trunk to 1.5 branch.

Modified:
    avro/branches/branch-1.5/   (props changed)
    avro/branches/branch-1.5/CHANGES.txt
    avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
    avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java

Propchange: avro/branches/branch-1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar  7 20:15:21 2011
@@ -1 +1 @@
-/avro/trunk:1075938,1075993
+/avro/trunk:1075938,1075993,1078917

Modified: avro/branches/branch-1.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/CHANGES.txt?rev=1078919&r1=1078918&r2=1078919&view=diff
==============================================================================
--- avro/branches/branch-1.5/CHANGES.txt (original)
+++ avro/branches/branch-1.5/CHANGES.txt Mon Mar  7 20:15:21 2011
@@ -145,6 +145,9 @@ Avro 1.5.0 (4 March 2011)
     AVRO-771. Java: Update dependency versions
     (scottcarey)
 
+    AVRO-726. Java: Make GenericDatum{Reader,Writer} easier to extend.
+    (scottcarey)
+
     AVRO-765. Java: Improvement to BinaryDecoder readLong performance
     (scottcarey)
   

Modified: avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java?rev=1078919&r1=1078918&r2=1078919&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
(original)
+++ avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
Mon Mar  7 20:15:21 2011
@@ -35,7 +35,7 @@ import org.apache.avro.util.WeakIdentity
 
 /** {@link DatumReader} for generic Java objects. */
 public class GenericDatumReader<D> implements DatumReader<D> {
-  private GenericData data;
+  private final GenericData data;
   private Schema actual;
   private Schema expected;
   
@@ -63,6 +63,9 @@ public class GenericDatumReader<D> imple
     this.creator = Thread.currentThread();
   }
 
+  /** Return the {@link GenericData} implementation. */
+  public GenericData getData() { return data; }
+
   @Override
   public void setSchema(Schema writer) {
     this.actual = writer;
@@ -86,7 +89,12 @@ public class GenericDatumReader<D> imple
     }
   };
 
-  private ResolvingDecoder getResolver(Schema actual, Schema expected)
+  /** Gets a resolving decoder for use by this GenericDatumReader.
+   *  Unstable API.
+   *  Currently uses a thread local cache to prevent constructing the
+   *  resolvers too often, because that is very expensive.
+   */
+  protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
     throws IOException {
     Thread currThread = Thread.currentThread();
     ResolvingDecoder resolver;

Modified: avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java?rev=1078919&r1=1078918&r2=1078919&view=diff
==============================================================================
--- avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
(original)
+++ avro/branches/branch-1.5/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
Mon Mar  7 20:15:21 2011
@@ -48,6 +48,9 @@ public class GenericDatumWriter<D> imple
     setSchema(root);
   }
 
+  /** Return the {@link GenericData} implementation. */
+  public GenericData getData() { return data; }
+
   public void setSchema(Schema root) { this.root = root; }
 
   public void write(D datum, Encoder out) throws IOException {
@@ -84,7 +87,8 @@ public class GenericDatumWriter<D> imple
     }
   }
 
-  private NullPointerException npe(NullPointerException e, String s) {
+  /** Helper method for adding a message to an NPE. */
+  protected NullPointerException npe(NullPointerException e, String s) {
     NullPointerException result = new NullPointerException(e.getMessage()+s);
     result.initCause(e.getCause() == null ? e : e.getCause());
     return result;



Mime
View raw message