public final class Binding<T>
extends java.lang.Object
Bindings are used to bind classes, optionally qualified by a JSR-330 qualifier annotation, to instances, providers or implementation classes.
Bindings may also specify a JSR-330 scope. If, and only if that scope is javax.inject.Singleton, then the binding may declare itself to be eagerly instantiated. In which case, it should be eagerly instantiated when Play starts up.
See the Module
class for information on how to provide bindings.
Constructor and Description |
---|
Binding(play.api.inject.Binding<T> underlying) |
Binding(BindingKey<T> key,
java.util.Optional<BindingTarget<T>> target,
java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> scope,
java.lang.Boolean eager,
java.lang.Object source) |
Modifier and Type | Method and Description |
---|---|
play.api.inject.Binding<T> |
asScala() |
Binding<T> |
eagerly()
Eagerly instantiate this binding when Play starts up.
|
java.lang.Boolean |
getEager() |
BindingKey<T> |
getKey() |
java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> |
getScope() |
java.lang.Object |
getSource() |
java.util.Optional<BindingTarget<T>> |
getTarget() |
<A extends java.lang.annotation.Annotation> |
in(java.lang.Class<A> scope)
Configure the scope for this binding.
|
java.lang.String |
toString() |
public Binding(BindingKey<T> key, java.util.Optional<BindingTarget<T>> target, java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> scope, java.lang.Boolean eager, java.lang.Object source)
key
- The binding key.target
- The binding target.scope
- The JSR-330 scope.eager
- Whether the binding should be eagerly instantiated.source
- Where this object was bound. Used in error reporting.public Binding(play.api.inject.Binding<T> underlying)
public BindingKey<T> getKey()
public java.util.Optional<BindingTarget<T>> getTarget()
public java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> getScope()
public java.lang.Boolean getEager()
public java.lang.Object getSource()
public <A extends java.lang.annotation.Annotation> Binding<T> in(java.lang.Class<A> scope)
public java.lang.String toString()
toString
in class java.lang.Object
public play.api.inject.Binding<T> asScala()