diff --git a/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionProvider.java b/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionProvider.java index 8f5ed03..b432d8c 100644 --- a/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionProvider.java +++ b/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionProvider.java @@ -1,5 +1,7 @@ package dev.tilera.cwg.api.options; +import dev.tilera.cwg.api.CwgGlobals; + public interface IGeneratorOptionProvider { Integer getInt(String id); @@ -12,4 +14,8 @@ public interface IGeneratorOptionProvider { T getValue(String id, Class type); + default IGeneratorOptionRegistry getRegistry() { + return CwgGlobals.getOptionRegistry(); + } + } diff --git a/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionRegistry.java b/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionRegistry.java index fcfcf76..e0cf2f0 100644 --- a/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionRegistry.java +++ b/src/main/java/dev/tilera/cwg/api/options/IGeneratorOptionRegistry.java @@ -18,4 +18,9 @@ public interface IGeneratorOptionRegistry extends IGeneratorOptionProvider { Class getOptionType(String id); + @Override + default IGeneratorOptionRegistry getRegistry() { + return this; + } + } diff --git a/src/main/java/dev/tilera/cwg/options/ConfigProvider.java b/src/main/java/dev/tilera/cwg/options/ConfigProvider.java index f314bd2..f9d7653 100644 --- a/src/main/java/dev/tilera/cwg/options/ConfigProvider.java +++ b/src/main/java/dev/tilera/cwg/options/ConfigProvider.java @@ -3,6 +3,7 @@ package dev.tilera.cwg.options; import dev.tilera.cwg.Config; import dev.tilera.cwg.api.CwgGlobals; import dev.tilera.cwg.api.options.IGeneratorOptionProvider; +import dev.tilera.cwg.api.options.IGeneratorOptionRegistry; public class ConfigProvider implements IGeneratorOptionProvider { @@ -49,5 +50,10 @@ public class ConfigProvider implements IGeneratorOptionProvider { } return parent.getValue(id, type); } + + @Override + public IGeneratorOptionRegistry getRegistry() { + return parent.getRegistry(); + } } diff --git a/src/main/java/dev/tilera/cwg/options/OptionProvider.java b/src/main/java/dev/tilera/cwg/options/OptionProvider.java index 1121b40..a5b2e49 100644 --- a/src/main/java/dev/tilera/cwg/options/OptionProvider.java +++ b/src/main/java/dev/tilera/cwg/options/OptionProvider.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import dev.tilera.cwg.api.options.IGeneratorOptionProvider; +import dev.tilera.cwg.api.options.IGeneratorOptionRegistry; public class OptionProvider implements IGeneratorOptionProvider { @@ -79,5 +80,10 @@ public class OptionProvider implements IGeneratorOptionProvider { public void putValue(String id, Object value) { storage.put(id, value); } + + @Override + public IGeneratorOptionRegistry getRegistry() { + return registry.getRegistry(); + } }