se.jbee.inject.bootstrap
Class Binding<T>
Object
se.jbee.inject.bootstrap.Binding<T>
- Type Parameters:
T - The type of the bound value (instance)
- All Implemented Interfaces:
- Comparable<Binding<?>>, Module, Resourced<T>, Typed<T>
public final class Binding<T>
- extends Object
- implements Comparable<Binding<?>>, Module, Typed<T>, Resourced<T>
Default data strature to represent a 4-tuple created from Bindings.
- Author:
- Jan Bernitt (jan@jbee.se)
| Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
type
public final BindingType type
supplier
public final Supplier<? extends T> supplier
scope
public final Scope scope
source
public final Source source
binding
public static <T> Binding<T> binding(Resource<T> resource,
BindingType type,
Supplier<? extends T> supplier,
Scope scope,
Source source)
getResource
public Resource<T> getResource()
- Specified by:
getResource in interface Resourced<T>
- Returns:
- The
Resource of this compound.
getInstance
public Instance<T> getInstance()
getType
public Type<T> getType()
- Specified by:
getType in interface Typed<T>
- Returns:
- The
Type of this object.
typed
public <E> Binding<E> typed(Type<E> type)
- Specified by:
typed in interface Typed<T>
- Returns:
- This object with the given
Type.
suppliedBy
public Binding<T> suppliedBy(BindingType type,
Supplier<? extends T> supplier)
declare
public void declare(Bindings bindings)
- Specified by:
declare in interface Module
- Parameters:
bindings - use to declare made bound within this Module.
compareTo
public int compareTo(Binding<?> other)
- Specified by:
compareTo in interface Comparable<Binding<?>>
toString
public String toString()
- Overrides:
toString in class Object
disambiguate
public static Binding<?>[] disambiguate(Binding<?>[] bindings)
- Removes those bindings that are ambiguous but also do not clash because of different
DeclarationTypes that replace each other.