Class InjectionKey<T>

java.lang.Object
de.tomatengames.util.injector.InjectionKey<T>
Type Parameters:
T - The type of the injection value associated with the key.

public final class InjectionKey<T> extends Object
An InjectionKey can be used as injection key for an InjectionProvider or for Injector.

That means an InjectionKey can be used for the methods AbstractInjectionProvider.provide(InjectionKey, Object) and InjectionInjectable.inject(InjectionKey).

InjectionKeys are unique per object identity.

Since:
1.9
  • Constructor Details

    • InjectionKey

      public InjectionKey(@Nullable String name)
      Creates a new InjectionKey.
      Parameters:
      name - The display name of the key. If null, the key will be displayed as a number. InjectionKeys are unique per object identity. Different keys with equal names are handled as independent keys. The name is used by the toString() method.
    • InjectionKey

      public InjectionKey()
      Creates a new InjectionKey. The display name will be a number.
  • Method Details