cdevents / sdk-java

Java SDK for CDEvents
Apache License 2.0
5 stars 6 forks source link

Should opt for immutability where we can #67

Open xibz opened 7 months ago

xibz commented 7 months ago

Currently all objects in the SDK are mutable. If a new event or object is needed, it should be recreated, instead of using setters to set things.

https://github.com/cdevents/sdk-java/blob/5d17b750fda57fd4a9d7ad2c5baec2bb4b9e2143/sdk/src/main/java/dev/cdevents/models/build/started/Subject.java#L113-L115

Instead we should utilize the builder pattern, imo. Look at lombok, https://projectlombok.org/features/Builder. This will make it a lot easier to generate these and make them properly immutable

aalmiray commented 5 months ago

Duplicate of #66