congbobo184 commented on a change in pull request #8372:
URL: https://github.com/apache/pulsar/pull/8372#discussion_r521782662
##########
File path:
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -251,6 +251,27 @@ default void configureSchemaInfo(String topic, String
componentName,
return DefaultImplementation.newProtobufSchema(schemaDefinition);
}
+ /**
+ * Create a Protobuf-Native schema type by extracting the fields of the
specified class.
+ *
+ * @param clazz the Protobuf generated class to be used to extract the
schema
+ * @return a Schema instance
+ */
+ static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T>
PROTOBUFNATIVE(Class<T> clazz) {
+ return
DefaultImplementation.newProtobufNativeSchema(SchemaDefinition.builder().withPojo(clazz).build());
+ }
+
+ /**
+ * Create a Protobuf-Native schema type with schema definition.
+ *
+ * @param schemaDefinition schemaDefinition the definition of the schema
+ * @return a Schema instance
+ */
+ static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T>
PROTOBUFNATIVE(
Review comment:
```suggestion
static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T>
PROTOBUF_NATIVE(
```
##########
File path:
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Schema.java
##########
@@ -251,6 +251,27 @@ default void configureSchemaInfo(String topic, String
componentName,
return DefaultImplementation.newProtobufSchema(schemaDefinition);
}
+ /**
+ * Create a Protobuf-Native schema type by extracting the fields of the
specified class.
+ *
+ * @param clazz the Protobuf generated class to be used to extract the
schema
+ * @return a Schema instance
+ */
+ static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T>
PROTOBUFNATIVE(Class<T> clazz) {
Review comment:
```suggestion
static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T>
PROTOBUF_NATIVE(Class<T> clazz) {
```
----------------------------------------------------------------
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:
[email protected]