in flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/schema/PulsarSchemaTypeSerializer.java [64:79]
public T createInstance() {
Class<T> recordClass = schema.getRecordClass();
// No exception wouldn't be thrown here if user don't provide protobuf-java.
if (haveProtobuf() && isProtobufTypeClass(recordClass)) {
try {
Method newBuilderMethod = recordClass.getMethod("newBuilder");
Message.Builder builder = (Message.Builder) newBuilderMethod.invoke(null);
return (T) builder.build();
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
} else {
return InstantiationUtil.instantiate(recordClass);
}
}