mirror of
https://github.com/apple/pkl.git
synced 2026-04-24 09:18:35 +02:00
Removed undeclared method reference in examples. (#341)
There is no method `evaluateText` in `ConfigEvaluator` or `ConfigEvaluatorImpl`.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import org.pkl.config.java.Config;
|
import org.pkl.config.java.Config;
|
||||||
import org.pkl.config.java.ConfigEvaluator;
|
import org.pkl.config.java.ConfigEvaluator;
|
||||||
import org.pkl.config.java.JavaType;
|
import org.pkl.config.java.JavaType;
|
||||||
|
import org.pkl.core.ModuleSource;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -11,8 +12,8 @@ public class JavaConfigExample {
|
|||||||
// tag::usage[]
|
// tag::usage[]
|
||||||
Config config;
|
Config config;
|
||||||
try (var evaluator = ConfigEvaluator.preconfigured()) { // <1>
|
try (var evaluator = ConfigEvaluator.preconfigured()) { // <1>
|
||||||
config = evaluator.evaluateText(
|
config = evaluator.evaluate(
|
||||||
"pigeon { age = 5; diet = \"Seeds\" }"); // <2>
|
ModuleSource.text("pigeon { age = 5; diet = \"Seeds\" }")); // <2>
|
||||||
}
|
}
|
||||||
var pigeon = config.get("pigeon"); // <3>
|
var pigeon = config.get("pigeon"); // <3>
|
||||||
var age = pigeon.get("age").as(int.class); // <4>
|
var age = pigeon.get("age").as(int.class); // <4>
|
||||||
|
|||||||
Reference in New Issue
Block a user