Package play.inject
Interface Injector
-
- All Known Implementing Classes:
DelegateInjector
public interface Injector
An injector, capable of providing components.This is an abstraction over whatever dependency injection is being used in Play. A minimal implementation may only call
newInstance
on the passed in class.This abstraction is primarily provided for libraries that want to remain agnostic to the type of dependency injection being used. End users are encouraged to use the facilities provided by the dependency injection framework they are using directly, for example, if using Guice, use
Injector
instead of this.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description play.api.inject.Injector
asScala()
Get as an instance of the Scala injector.<T> T
instanceOf(Class<T> clazz)
Get an instance of the given class from the injector.<T> T
instanceOf(play.api.inject.BindingKey<T> key)
Get an instance of the given class from the injector.
-
-
-
Method Detail
-
instanceOf
<T> T instanceOf(Class<T> clazz)
Get an instance of the given class from the injector.- Type Parameters:
T
- the type of the instance- Parameters:
clazz
- The class to get the instance of- Returns:
- The instance
-
instanceOf
<T> T instanceOf(play.api.inject.BindingKey<T> key)
Get an instance of the given class from the injector.- Type Parameters:
T
- the type of the instance- Parameters:
key
- The key of the binding- Returns:
- The instance
-
asScala
play.api.inject.Injector asScala()
Get as an instance of the Scala injector.- Returns:
- an instance of the Scala injector.
- See Also:
Injector
-
-