merlimat commented on a change in pull request #3752: revise the schema default 
type not null
URL: https://github.com/apache/pulsar/pull/3752#discussion_r264982965
 
 

 ##########
 File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
 ##########
 @@ -167,25 +168,47 @@ default T decode(byte[] bytes, byte[] schemaVersion) {
     }
 
     /**
-     * Create a Avro schema type by extracting the fields of the specified 
class.
+     * Create a  Avro schema type by default configuration of the class
      *
      * @param clazz the POJO class to be used to extract the Avro schema
      * @return a Schema instance
      */
     static <T> Schema<T> AVRO(Class<T> clazz) {
-        return DefaultImplementation.newAvroSchema(clazz);
+        return DefaultImplementation.newAvroSchema(new 
SchemaDefinition<>(clazz));
     }
 
     /**
-     * Create a JSON schema type by extracting the fields of the specified 
class.
+     * Create a Avro schema type with schema definition
+     *
+     * @param schemaDefinition the definition of the schema
+     * @return a Schema instance
+     */
+    static <T> Schema<T> AVRO(SchemaDefinition<T> schemaDefinition) {
 
 Review comment:
   > I don't think AvroDefinition is a good name. it is confusing - does it 
mean it is for avro schema, or it is for generated the avro formatted schema. I 
think SchemaDefinition is much better.
   
   Sure that's probably not a good naming. Though I'd be careful in using 
constructor approach since it makes it harder to extend, compared to using 
builder pattern.
   
   > if pojo class is omitted, the schema definition is generated from the json 
string. 
   
   Ok that would make the `Producer<Object>` which should still be fine (in the 
Avro case) since the avro schema is the one that is really deciding the 
serialization.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to