eolivelli commented on a change in pull request #9614:
URL: https://github.com/apache/pulsar/pull/9614#discussion_r589275290



##########
File path: 
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/schema/GenericRecord.java
##########
@@ -61,4 +64,29 @@ default Object getField(Field field) {
      */
     Object getField(String fieldName);
 
+    /**
+     * Return the schema tyoe.
+     *
+     * @return the schema type
+     * @throws UnsupportedOperationException if this feature is not implemented
+     * @see SchemaType#AVRO
+     * @see SchemaType#PROTOBUF_NATIVE
+     * @see SchemaType#JSON
+     */
+    default SchemaType getSchemaType() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Return the internal native representation of the Record,
+     * like a AVRO GenericRecord.
+     * You have to pass the type you would like to obtain.
+     * This method will return null if such type is not supported.
+     *
+     * @return the internal representation of the record, or null if the 
requested information is not available.
+     */
+    default <T> T getNativeRecord(Class<T> clazz) {
+        return null;

Review comment:
       because we do not have a good "default value" for `getSchemaType`
   
   but for this method the expected behaviour is that you get a `null` value if 
you are asking for an unsupported interface, so returning `null` here is the 
expected behaviour.




----------------------------------------------------------------
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


Reply via email to