Class IterableProviderImpl<T>
java.lang.Object
org.jvnet.hk2.internal.IterableProviderImpl<T>
- Type Parameters:
T- The type for this provider
- All Implemented Interfaces:
Iterable<T>, javax.inject.Provider<T>, IterableProvider<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final ServiceLocatorImplprivate final Injecteeprivate final Set<Annotation> private final Typeprivate final Unqualified -
Constructor Summary
ConstructorsConstructorDescriptionIterableProviderImpl(ServiceLocatorImpl locator, Type requiredType, Set<Annotation> requiredQualifiers, Unqualified unqualified, Injectee originalInjectee, boolean isIterable) -
Method Summary
Modifier and TypeMethodDescriptionget()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.intgetSize()Returns the size of the iterator that would be returnedThis version of iterator returns an iterator of ServiceHandles rather than returning the services (which then have no way to be properly destroyed)iterator()private voidReturns an IterableProvider that is further qualified with the given name<U> IterableProvider<U> Returns an IterableProvider that is of the given type.qualifiedWith(Annotation... qualifiers) A set of qualifiers to further restrict this iterator to.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
locator
-
requiredType
-
requiredQualifiers
-
unqualified
-
originalInjectee
-
isIterable
private final boolean isIterable
-
-
Constructor Details
-
IterableProviderImpl
IterableProviderImpl(ServiceLocatorImpl locator, Type requiredType, Set<Annotation> requiredQualifiers, Unqualified unqualified, Injectee originalInjectee, boolean isIterable)
-
-
Method Details
-
justInTime
private void justInTime() -
get
-
getHandle
Description copied from interface:IterableProviderRather 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.- Specified by:
getHandlein interfaceIterableProvider<T>- Returns:
- A ServiceHandle for the service, or null if there is currently no service definition available
-
iterator
-
getSize
public int getSize()Description copied from interface:IterableProviderReturns the size of the iterator that would be returned- Specified by:
getSizein interfaceIterableProvider<T>- Returns:
- the size of the iterator that would be chosen
-
named
Description copied from interface:IterableProviderReturns an IterableProvider that is further qualified with the given name- Specified by:
namedin interfaceIterableProvider<T>- Parameters:
name- The value field of the Named annotation parameter. Must not be null- Returns:
- An iterable provider further qualified with the given name
-
ofType
Description copied from interface:IterableProviderReturns an IterableProvider that is of the given type. This type must be one of the type safe contracts of the original iterator- Specified by:
ofTypein interfaceIterableProvider<T>- Parameters:
type- The type to restrict the returned iterator to- Returns:
- An iterator restricted to only providing the given type
-
qualifiedWith
Description copied from interface:IterableProviderA set of qualifiers to further restrict this iterator to.- Specified by:
qualifiedWithin interfaceIterableProvider<T>- Parameters:
qualifiers- The qualifiers to further restrict this iterator to- Returns:
- An iterator restricted with the given qualifiers
-
handleIterator
Description copied from interface:IterableProviderThis version of iterator returns an iterator of ServiceHandles rather than returning the services (which then have no way to be properly destroyed)- Specified by:
handleIteratorin interfaceIterableProvider<T>- Returns:
- An iterator of ServiceHandles for the set of services represtended by this IterableProvider
-
toString
-