Removed undeclared method reference in examples. (#341)

There is no method `evaluateText` in `ConfigEvaluator` or `ConfigEvaluatorImpl`.
This commit is contained in:
Zihlu Wang
2024-03-20 00:13:33 +08:00
committed by GitHub
parent 76f3890cff
commit 4ce7a82db5

View File

@@ -1,6 +1,7 @@
import org.pkl.config.java.Config;
import org.pkl.config.java.ConfigEvaluator;
import org.pkl.config.java.JavaType;
import org.pkl.core.ModuleSource;
import org.junit.jupiter.api.Test;
@SuppressWarnings("unused")
@@ -11,8 +12,8 @@ public class JavaConfigExample {
// tag::usage[]
Config config;
try (var evaluator = ConfigEvaluator.preconfigured()) { // <1>
config = evaluator.evaluateText(
"pigeon { age = 5; diet = \"Seeds\" }"); // <2>
config = evaluator.evaluate(
ModuleSource.text("pigeon { age = 5; diet = \"Seeds\" }")); // <2>
}
var pigeon = config.get("pigeon"); // <3>
var age = pigeon.get("age").as(int.class); // <4>