Package play.inject
Class Binding<T>
- Object
-
- play.inject.Binding<T>
-
public final class Binding<T> extends Object
A binding.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 Summary
Constructors Constructor Description Binding(play.api.inject.Binding<T> underlying)
Binding(BindingKey<T> key, Optional<BindingTarget<T>> target, Optional<Class<? extends Annotation>> scope, Boolean eager, Object source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description play.api.inject.Binding<T>
asScala()
Binding<T>
eagerly()
Eagerly instantiate this binding when Play starts up.Boolean
getEager()
BindingKey<T>
getKey()
Optional<Class<? extends Annotation>>
getScope()
Object
getSource()
Optional<BindingTarget<T>>
getTarget()
<A extends Annotation>
Binding<T>in(Class<A> scope)
Configure the scope for this binding.String
toString()
-
-
-
Constructor Detail
-
Binding
public Binding(BindingKey<T> key, Optional<BindingTarget<T>> target, Optional<Class<? extends Annotation>> scope, Boolean eager, Object source)
- Parameters:
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.
-
Binding
public Binding(play.api.inject.Binding<T> underlying)
-
-
Method Detail
-
getKey
public BindingKey<T> getKey()
-
getTarget
public Optional<BindingTarget<T>> getTarget()
-
getScope
public Optional<Class<? extends Annotation>> getScope()
-
getEager
public Boolean getEager()
-
getSource
public Object getSource()
-
in
public <A extends Annotation> Binding<T> in(Class<A> scope)
Configure the scope for this binding.
-
asScala
public play.api.inject.Binding<T> asScala()
-
-