+ New findCodeNameBase(String)
method returning
+ ModuleInfo
+ or null
.
+
null
, if such module is not known
+ * to the system
+ * @since 7.37
*/
- protected Modules() {}
+ public ModuleInfo findCodeNameBase(String cnb) {
+ for (ModuleInfo module : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
+ if (cnb.equals(module.getCodeNameBase())) {
+ return module;
+ }
+ }
+ return null;
+ }
/**
* Finds the module which loaded a class.
@@ -75,19 +89,12 @@
* @return the owner of the class, or null if it is not owned by any module
* @see ModuleInfo#owns
*/
- public abstract ModuleInfo ownerOf(Class> clazz);
-
- private static class Trivial extends Modules {
-
- public @Override ModuleInfo ownerOf(Class> clazz) {
- for (ModuleInfo module : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
- if (module.owns(clazz)) {
- return module;
- }
+ public ModuleInfo ownerOf(Class> clazz) {
+ for (ModuleInfo module : Lookup.getDefault().lookupAll(ModuleInfo.class)) {
+ if (module.owns(clazz)) {
+ return module;
}
- return null;
}
-
+ return null;
}
-
}