mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
persisting_state_of_components.md: Emphasize immutability and thread safety of SerializablePersistentStateComponent
This commit is contained in:
parent
22a9169b92
commit
a01fb3b665
@ -61,10 +61,10 @@ class MySettings : SimplePersistentStateComponent<MySettings.State>(State()) {
|
|||||||
<chapter title="SerializablePersistentStateComponent" id="SerializablePersistentStateComponent">
|
<chapter title="SerializablePersistentStateComponent" id="SerializablePersistentStateComponent">
|
||||||
<primary-label ref="2022.2"/>
|
<primary-label ref="2022.2"/>
|
||||||
|
|
||||||
[`SerializablePersistentStateComponent`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/components/SerializablePersistentStateComponent.kt) is parameterized with a state data class.
|
[`SerializablePersistentStateComponent`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/components/SerializablePersistentStateComponent.kt) is parameterized with an immutable state data class.
|
||||||
|
|
||||||
State properties are exposed via persistent state component class' properties.
|
State properties are exposed for reading and modification via persistent state component class' properties.
|
||||||
The state properties are modified by copying the state and overwriting a modified value within `SerializablePersistentStateComponent.updateState()`, which ensures atomic modification.
|
The state properties are modified by copying the state and overwriting a modified value within `SerializablePersistentStateComponent.updateState()`, which ensures atomic modification and thread safety.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user