From b9a8b7a3f62f637f541df557a7e3d245c903fe68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Nov 2024 22:38:21 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=9A=B8=20Add=20alternative=20to=20`is`=20m?= =?utf8?q?ethod=20because=20that=20sucks=20in=20Kotlin?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/util/inject/ObjectBinding.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/util/inject/ObjectBinding.java b/src/main/java/net/pterodactylus/util/inject/ObjectBinding.java index 7cc41d2..e8fb65a 100644 --- a/src/main/java/net/pterodactylus/util/inject/ObjectBinding.java +++ b/src/main/java/net/pterodactylus/util/inject/ObjectBinding.java @@ -2,7 +2,6 @@ package net.pterodactylus.util.inject; import com.google.inject.Key; import com.google.inject.Module; -import com.google.inject.name.Names; import static com.google.inject.name.Names.named; @@ -29,6 +28,10 @@ public class ObjectBinding { return (binder) -> binder.bind(requestedClass).toInstance(instance); } + public Module shallBe(T instance) { + return is(instance); + } + public $2 named(String name) { return new $2<>(requestedClass, name); } @@ -46,6 +49,10 @@ public class ObjectBinding { return (binder) -> binder.bind(Key.get(requestedClass, named(name))).toInstance(instance); } + public Module shallBe(T instance) { + return is(instance); + } + private final Class requestedClass; private final String name; -- 2.7.4