Binding { public CanBeReleasable singleton() { isCreatingSingleton = true; return new CanBeReleasable(); } Binding(Class<T> key); CanBeReleasable singleton(); Mode getMode(); Class<T> getKey(); Class<? extends T> getImplementationClass(); T getInstance(); Provider<? extends T> getProviderInstance(); Class<? extends Provider<? extends T>> getProviderClass(); String getName(); boolean isCreatingSingleton(); boolean isProvidingSingleton(); boolean isCreatingReleasable(); boolean isProvidingReleasable();  }
@Test public void testBindingAPI() { new Module().bind(String.class).toInstance(""); new Module().bind(String.class).withName("").toInstance(""); new Module().bind(String.class).withName(Named.class).toInstance(""); new Module().bind(String.class).to(String.class); new Module().bind(String.class).withName("").to(String.class); new Module().bind(String.class).withName(Named.class).to(String.class); new Module().bind(String.class).to(String.class).singleton(); new Module().bind(String.class).to(String.class).singleton().releasable(); new Module().bind(String.class).toProviderInstance(new StringProvider()); new Module().bind(String.class).withName("").toProviderInstance(new StringProvider()); new Module().bind(String.class).withName(Named.class).toProviderInstance(new StringProvider()); new Module().bind(String.class).toProviderInstance(new StringProvider()).providesSingleton(); new Module() .bind(String.class) .toProviderInstance(new StringProvider()) .providesSingleton() .providesReleasable(); new Module().bind(String.class).toProvider(StringProvider.class); new Module().bind(String.class).withName("").toProvider(StringProvider.class); new Module().bind(String.class).withName(Named.class).toProvider(StringProvider.class); new Module().bind(String.class).toProvider(StringProvider.class).singleton(); new Module().bind(String.class).toProvider(StringProvider.class).singleton().releasable(); new Module().bind(String.class).toProvider(StringProvider.class).providesSingleton(); new Module() .bind(String.class) .toProvider(StringProvider.class) .providesSingleton() .providesReleasable(); new Module() .bind(String.class) .toProvider(StringProvider.class) .providesSingleton() .providesReleasable() .singleton(); }