avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fo...@apache.org
Subject [avro] branch branch-1.9 updated: AVRO-2515: Expand access of ProtobufData methods (#612)
Date Thu, 22 Aug 2019 11:25:05 GMT
This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new f8c22c8  AVRO-2515: Expand access of ProtobufData methods (#612)
f8c22c8 is described below

commit f8c22c8acccea720bb0baa0951a2586c29197461
Author: Teodor Kostov <terusus@gmail.com>
AuthorDate: Thu Aug 22 13:23:53 2019 +0200

    AVRO-2515: Expand access of ProtobufData methods (#612)
    
    Chandged from private to public getSchema(FieldDescriptor) and
    getNamespace(FileDescriptor, Descriptor).
    
    The utility methods that deal with the conversion from Protobuf message
    descriptor to an Avro schema are now exposed on a more granular level.
    This will alow the library clients to use this functionality and not
    reinvent it. This will also help with extending the base functionality.
    For example, adding protobuf meta information to the schema as
    properties.
    
    (cherry picked from commit bce00d9c4a44f66c6906e66cde21938935c00fc5)
---
 .../protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java b/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
index da00535..5c403bb 100644
--- a/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
+++ b/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
@@ -226,7 +226,7 @@ public class ProtobufData extends GenericData {
     }
   }
 
-  private String getNamespace(FileDescriptor fd, Descriptor containing) {
+  public String getNamespace(FileDescriptor fd, Descriptor containing) {
     FileOptions o = fd.getOptions();
     String p = o.hasJavaPackage() ? o.getJavaPackage() : fd.getPackage();
     String outer = "";
@@ -268,7 +268,7 @@ public class ProtobufData extends GenericData {
 
   private static final Schema NULL = Schema.create(Schema.Type.NULL);
 
-  private Schema getSchema(FieldDescriptor f) {
+  public Schema getSchema(FieldDescriptor f) {
     Schema s = getNonRepeatedSchema(f);
     if (f.isRepeated())
       s = Schema.createArray(s);


Mime
View raw message