Skip to content

Commit af87d7c

Browse files
docs: add immutability explanation to readme (#265)
1 parent 20822d6 commit af87d7c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ To send a request to the Orb API, build an instance of some `Params` class and p
109109

110110
For example, `client.customers().create(...)` should be called with an instance of `CustomerCreateParams`, and it will return an instance of `Customer`.
111111

112+
## Immutability
113+
114+
Each class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.
115+
116+
Each class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.
117+
118+
Because each class is immutable, builder modification will _never_ affect already built class instances.
119+
112120
## Asynchronous execution
113121

114122
The default client is synchronous. To switch to asynchronous execution, call the `async()` method:

0 commit comments

Comments
 (0)