Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: Fix wrong example for Config.onChange (#8607) #8608

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/se/config/mutability-support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ method on the node of interest.
include::{sourcedir}/se/config/MutabilitySupportSnippets.java[tag=snippet_3, indent=0]
----
<1> Navigate to the `Config` node on which you want to register.
<2> Invoke the `onChange` method, passing a function (`Function<Config, Boolean>`).
The config system invokes that function each time the subtree rooted at the
<2> Invoke the `onChange` method, passing a consumer (`Consumer<Config>`).
The config system invokes that consumer each time the subtree rooted at the
`greeting` node changes. The `changedNode` is a new instance of `Config`
representing the updated subtree rooted at `greeting`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void snippet_2() {
void snippet_3(Config config) {
// tag::snippet_3[]
config.get("greeting") // <1>
.onChange((changedNode) -> { // <2>
.onChange(changedNode -> { // <2>
System.out.println("Node " + changedNode.key() + " has changed!");
});
// end::snippet_3[]
Expand Down