62 * method to do resolution with service binding. There are instance and |
62 * method to do resolution with service binding. There are instance and |
63 * static variants of both methods. The instance methods create a configuration |
63 * static variants of both methods. The instance methods create a configuration |
64 * with the receiver as the parent configuration. The static methods are for |
64 * with the receiver as the parent configuration. The static methods are for |
65 * more advanced cases where there can be more than one parent configuration. </p> |
65 * more advanced cases where there can be more than one parent configuration. </p> |
66 * |
66 * |
67 * <p> Each {@link java.lang.reflect.Layer layer} of modules in the Java virtual |
67 * <p> Each {@link java.lang.ModuleLayer layer} of modules in the Java virtual |
68 * machine is created from a configuration. The configuration for the {@link |
68 * machine is created from a configuration. The configuration for the {@link |
69 * java.lang.reflect.Layer#boot() boot} layer is obtained by invoking {@code |
69 * java.lang.ModuleLayer#boot() boot} layer is obtained by invoking {@code |
70 * Layer.boot().configuration()}. The configuration for the boot layer will |
70 * ModuleLayer.boot().configuration()}. The configuration for the boot layer |
71 * often be the parent when creating new configurations. </p> |
71 * will often be the parent when creating new configurations. </p> |
72 * |
72 * |
73 * <h3> Example </h3> |
73 * <h3> Example </h3> |
74 * |
74 * |
75 * <p> The following example uses the {@link |
75 * <p> The following example uses the {@link |
76 * #resolve(ModuleFinder,ModuleFinder,Collection) resolve} method to resolve a |
76 * #resolve(ModuleFinder,ModuleFinder,Collection) resolve} method to resolve a |
79 * names of the modules that each module reads. </p> |
79 * names of the modules that each module reads. </p> |
80 * |
80 * |
81 * <pre>{@code |
81 * <pre>{@code |
82 * ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3); |
82 * ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3); |
83 * |
83 * |
84 * Configuration parent = Layer.boot().configuration(); |
84 * Configuration parent = ModuleLayer.boot().configuration(); |
85 * |
85 * |
86 * Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("myapp")); |
86 * Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of("myapp")); |
87 * cf.modules().forEach(m -> { |
87 * cf.modules().forEach(m -> { |
88 * System.out.format("%s -> %s%n", |
88 * System.out.format("%s -> %s%n", |
89 * m.name(), |
89 * m.name(), |