[ https://issues.apache.org/jira/browse/CASSANDRA-20404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maulin Vasavada updated CASSANDRA-20404: ---------------------------------------- Summary: Improve EncryptionOptions class's `with` methods using Builder pattern (was: Improve EncryptionOptions class's with methods using Builder pattern) > Improve EncryptionOptions class's `with` methods using Builder pattern > ---------------------------------------------------------------------- > > Key: CASSANDRA-20404 > URL: https://issues.apache.org/jira/browse/CASSANDRA-20404 > Project: Apache Cassandra > Issue Type: Improvement > Reporter: Maulin Vasavada > Priority: Normal > > Currently, > [EncryptionOptions.java|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/config/EncryptionOptions.java#L520] > allows constructing the object using `with` prefix method pattern which > sounds similar to the Builder Pattern > ([example)|https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java] > However, when there is any new parameter introduced in the class for a > corresponding configuration option, it requires changes to all the > constructor calls from those `with` methods to reflect the new parameter. > This is error prone given so many string parameters and considering some > [special > use-cases|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/config/EncryptionOptions.java#L1190] > it makes it challenging to modify the code for a simple task - adding a new > parameter in the class. > > Proposal here is to use the Builder pattern (like shows in the example linked > above) to improve the code in EncryptionOptions.java file. > There could be a potential to consider using "java record" type that got > introduced in Java 14+ but in order to be backward compatible may be we can > simply follow the builder pattern. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org