cdevents / sdk-java

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

We should opt for immutability when we can #66

Open xibz opened 8 months ago

xibz commented 8 months ago

When constructing objects, we can freely change them whenever via the setters. I would not to not allow for this and go with a more immutable approach.

aalmiray commented 6 months ago

The jsonschema2pojo plugin allows generating builders associated with pojos, that way pojo classes may remain immutable while the builders provide mutability. However, this would constitute a breaking change in API usage. Given that the API is still pre 1.0.0 is permissible but such change (if green lighted) must be communicated in advance to consumers.

cc: @afrittoli @rjalander