You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by fo...@apache.org on 2019/08/22 11:23:59 UTC

[avro] branch master updated: AVRO-2515: Expand access of ProtobufData methods (#612)

This is an automated email from the ASF dual-hosted git repository.

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


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

commit bce00d9c4a44f66c6906e66cde21938935c00fc5
Author: Teodor Kostov <te...@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.
---
 .../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);