use of com.google.inject.Exposed in project LanternServer by LanternPowered.
the class LanternModule method provideAssetManager.
@Exposed
@Provides
@Singleton
private LanternAssetManager provideAssetManager(@Option({ "asset-repository-config", "asset-repo-config" }) @Nullable Path repoConfig, LanternPluginManager pluginManager) {
final Gson gson = new GsonBuilder().registerTypeAdapter(AssetRepository.class, new AssetRepositoryJsonDeserializer(pluginManager)).create();
try {
URL url;
if (repoConfig != null) {
url = PathUtils.toURL(repoConfig);
} else {
url = getClass().getClassLoader().getResource("assets_repo.json");
checkNotNull(url);
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
return new LanternAssetManager(gson.fromJson(reader, AssetRepository.class));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.google.inject.Exposed in project guice by google.
the class ModuleAnnotatedMethodScannerTest method privateModuleInheritScanner_usingPrivateModule.
@Test
public void privateModuleInheritScanner_usingPrivateModule() {
Injector injector = Guice.createInjector(scannerModule(new NamedMunger()), new PrivateModule() {
@Override
protected void configure() {
}
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
Aggregations