Skip to content

Commit 8f256fb

Browse files
docs: add immutability explanation to readme (#452)
1 parent 344ac4b commit 8f256fb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

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

121121
For example, `client.hris().directory().list(...)` should be called with an instance of `HrisDirectoryListParams`, and it will return an instance of `HrisDirectoryListPage`.
122122

123+
## Immutability
124+
125+
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.
126+
127+
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.
128+
129+
Because each class is immutable, builder modification will _never_ affect already built class instances.
130+
123131
## Asynchronous execution
124132

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

0 commit comments

Comments
 (0)