From f0c3b4b14900288779e542618552fabb2112cbbd Mon Sep 17 00:00:00 2001 From: Andrei Arlou Date: Wed, 3 Apr 2024 08:14:40 +0300 Subject: [PATCH] [4.x]: Fix wrong example for Config.onChange (#8607) --- docs/src/main/asciidoc/se/config/mutability-support.adoc | 4 ++-- .../io/helidon/docs/se/config/MutabilitySupportSnippets.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/main/asciidoc/se/config/mutability-support.adoc b/docs/src/main/asciidoc/se/config/mutability-support.adoc index fa5bec2a1e2..030520dac37 100644 --- a/docs/src/main/asciidoc/se/config/mutability-support.adoc +++ b/docs/src/main/asciidoc/se/config/mutability-support.adoc @@ -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`). -The config system invokes that function each time the subtree rooted at the +<2> Invoke the `onChange` method, passing a consumer (`Consumer`). +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`. diff --git a/docs/src/main/java/io/helidon/docs/se/config/MutabilitySupportSnippets.java b/docs/src/main/java/io/helidon/docs/se/config/MutabilitySupportSnippets.java index 3e72b78b1ad..fbd36e3292d 100644 --- a/docs/src/main/java/io/helidon/docs/se/config/MutabilitySupportSnippets.java +++ b/docs/src/main/java/io/helidon/docs/se/config/MutabilitySupportSnippets.java @@ -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[]