T
- The type for this providerpublic class IterableProviderImpl<T> extends java.lang.Object implements IterableProvider<T>
Modifier and Type | Class and Description |
---|---|
private static class |
IterableProviderImpl.HandleIterable<U> |
private static class |
IterableProviderImpl.MyHandleIterator<U> |
private static class |
IterableProviderImpl.MyIterator<U> |
Modifier and Type | Field and Description |
---|---|
private boolean |
isIterable |
private ServiceLocatorImpl |
locator |
private Injectee |
originalInjectee |
private java.util.Set<java.lang.annotation.Annotation> |
requiredQualifiers |
private java.lang.reflect.Type |
requiredType |
private Unqualified |
unqualified |
Constructor and Description |
---|
IterableProviderImpl(ServiceLocatorImpl locator,
java.lang.reflect.Type requiredType,
java.util.Set<java.lang.annotation.Annotation> requiredQualifiers,
Unqualified unqualified,
Injectee originalInjectee,
boolean isIterable) |
Modifier and Type | Method and Description |
---|---|
T |
get() |
ServiceHandle<T> |
getHandle()
Rather than getting the service directly with get (in which
case the returned service cannot be disposed of) this method
will instead return a service handle for the current best service.
|
int |
getSize()
Returns the size of the iterator that would be returned
|
java.lang.Iterable<ServiceHandle<T>> |
handleIterator()
This version of iterator returns an iterator of ServiceHandles rather
than returning the services (which then have no way to be properly
destroyed)
|
java.util.Iterator<T> |
iterator() |
private void |
justInTime() |
IterableProvider<T> |
named(java.lang.String name)
Returns an IterableProvider that is further qualified
with the given name
|
<U> IterableProvider<U> |
ofType(java.lang.reflect.Type type)
Returns an IterableProvider that is of the given type.
|
IterableProvider<T> |
qualifiedWith(java.lang.annotation.Annotation... qualifiers)
A set of qualifiers to further restrict this iterator to.
|
java.lang.String |
toString() |
private final ServiceLocatorImpl locator
private final java.lang.reflect.Type requiredType
private final java.util.Set<java.lang.annotation.Annotation> requiredQualifiers
private final Unqualified unqualified
private final Injectee originalInjectee
private final boolean isIterable
IterableProviderImpl(ServiceLocatorImpl locator, java.lang.reflect.Type requiredType, java.util.Set<java.lang.annotation.Annotation> requiredQualifiers, Unqualified unqualified, Injectee originalInjectee, boolean isIterable)
private void justInTime()
public ServiceHandle<T> getHandle()
IterableProvider
getHandle
in interface IterableProvider<T>
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public int getSize()
IterableProvider
getSize
in interface IterableProvider<T>
public IterableProvider<T> named(java.lang.String name)
IterableProvider
named
in interface IterableProvider<T>
name
- The value field of the Named annotation parameter. Must
not be nullpublic <U> IterableProvider<U> ofType(java.lang.reflect.Type type)
IterableProvider
ofType
in interface IterableProvider<T>
type
- The type to restrict the returned iterator topublic IterableProvider<T> qualifiedWith(java.lang.annotation.Annotation... qualifiers)
IterableProvider
qualifiedWith
in interface IterableProvider<T>
qualifiers
- The qualifiers to further restrict this iterator topublic java.lang.Iterable<ServiceHandle<T>> handleIterator()
IterableProvider
handleIterator
in interface IterableProvider<T>
public java.lang.String toString()
toString
in class java.lang.Object