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



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AbstractSchema.java
##########
@@ -67,4 +69,20 @@ public T decode(ByteBuf byteBuf, byte[] schemaVersion) {
     public Schema<T> clone() {
         return this;
     }
+
+    /**
+     * Return an instance of this schema at the given version.
+     * @param schemaVersion the version
+     * @return the schema at that specific version
+     * @throws SchemaSerializationException in case of unknown schema version
+     * @throws NullPointerException in case of null schemaVersion
+     */
+    public Schema<?> atSchemaVersion(byte[] schemaVersion) throws 
SchemaSerializationException {

Review comment:
       It sounds to me pretty good, let's see this example:
   ```
   Schema<?> schema = .....
   Schema<?> schemaVersion2 = schema.atSchemaVersion(2);
   ```
   In this example is like having immutable objects, and you call a method to 
create a new object with different content
   
   With getSchemaByVersion it looks to that a Schema is a "container" (or a 
registry) for Schemas
   ```
   Schema<?> schema = .....
   Schema<?> schemaVersion2 = schema.getSchemaByVersion(2);
   ```
   




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


Reply via email to