Top Inners Fields Constructors Methods
org.jvnet.hk2.internal

public Class IterableProviderImpl<T>

extends Object
implements IterableProvider<T>
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.IterableProvider, java.lang.Iterable, jakarta.inject.Provider
Type Parameters
<T>
The type for this provider
Imports
java.lang.annotation.Annotation, java.lang.reflect.Type, java.util.Collections, .HashSet, .Iterator, .LinkedList, .List, .NoSuchElementException, .Set, org.glassfish.hk2.api.Injectee, .IterableProvider, .ServiceHandle, .Unqualified, org.glassfish.hk2.utilities.InjecteeImpl, .NamedImpl, org.glassfish.hk2.utilities.reflection.Pretty, .ReflectionHelper

Author
jwells

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final boolean
private final ServiceLocatorImpl
private final Injectee
private final Set<Annotation>
private final Type
private final Unqualified

Constructor Summary

AccessConstructor and Description
pack-priv
IterableProviderImpl(ServiceLocatorImpl locator, Type requiredType, Set<Annotation> requiredQualifiers, Unqualified unqualified, Injectee originalInjectee, boolean isIterable)

Method Summary

Modifier and TypeMethod and Description
public T
get()

Implements jakarta.inject.Provider.get.

Provides a fully-constructed and injected instance of T.

public ServiceHandle<T>
getHandle()

Implements org.glassfish.hk2.api.IterableProvider.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.

public int
getSize()

Implements org.glassfish.hk2.api.IterableProvider.getSize.

Returns the size of the iterator that would be returned

public Iterable<ServiceHandle<T>>
handleIterator()

Implements org.glassfish.hk2.api.IterableProvider.handleIterator.

This version of iterator returns an iterator of ServiceHandles rather than returning the services (which then have no way to be properly destroyed)

public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

private void
public IterableProvider<T>
named(String name)

Implements org.glassfish.hk2.api.IterableProvider.named.

Returns an IterableProvider that is further qualified with the given name

public <U> IterableProvider<U>
ofType(Type type)

Implements org.glassfish.hk2.api.IterableProvider.ofType.

Returns an IterableProvider that is of the given type.

public IterableProvider<T>
qualifiedWith(Annotation... qualifiers)

Implements org.glassfish.hk2.api.IterableProvider.qualifiedWith.

A set of qualifiers to further restrict this iterator to.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

isIterableback to summary
private final boolean isIterable
locatorback to summary
private final ServiceLocatorImpl locator
originalInjecteeback to summary
private final Injectee originalInjectee
requiredQualifiersback to summary
private final Set<Annotation> requiredQualifiers
requiredTypeback to summary
private final Type requiredType
unqualifiedback to summary
private final Unqualified unqualified

Constructor Detail

IterableProviderImplback to summary
pack-priv IterableProviderImpl(ServiceLocatorImpl locator, Type requiredType, Set<Annotation> requiredQualifiers, Unqualified unqualified, Injectee originalInjectee, boolean isIterable)

Method Detail

getback to summary
public T get()

Implements jakarta.inject.Provider.get.

Doc from jakarta.inject.Provider.get.

Provides a fully-constructed and injected instance of T.

Annotations
@SuppressWarnings:unchecked
@Override
getHandleback to summary
public ServiceHandle<T> getHandle()

Implements org.glassfish.hk2.api.IterableProvider.getHandle.

Doc from org.glassfish.hk2.api.IterableProvider.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.

Annotations
@SuppressWarnings:unchecked
@Override
getSizeback to summary
public int getSize()

Implements org.glassfish.hk2.api.IterableProvider.getSize.

Doc from org.glassfish.hk2.api.IterableProvider.getSize.

Returns the size of the iterator that would be returned

Annotations
@Override
handleIteratorback to summary
public Iterable<ServiceHandle<T>> handleIterator()

Implements org.glassfish.hk2.api.IterableProvider.handleIterator.

Doc from org.glassfish.hk2.api.IterableProvider.handleIterator.

This version of iterator returns an iterator of ServiceHandles rather than returning the services (which then have no way to be properly destroyed)

Annotations
@Override
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
justInTimeback to summary
private void justInTime()
namedback to summary
public IterableProvider<T> named(String name)

Implements org.glassfish.hk2.api.IterableProvider.named.

Doc from org.glassfish.hk2.api.IterableProvider.named.

Returns an IterableProvider that is further qualified with the given name

Annotations
@Override
ofTypeback to summary
public <U> IterableProvider<U> ofType(Type type)

Implements org.glassfish.hk2.api.IterableProvider.ofType.

Doc from org.glassfish.hk2.api.IterableProvider.ofType.

Returns an IterableProvider that is of the given type. This type must be one of the type safe contracts of the original iterator

Annotations
@Override
qualifiedWithback to summary
public IterableProvider<T> qualifiedWith(Annotation... qualifiers)

Implements org.glassfish.hk2.api.IterableProvider.qualifiedWith.

Doc from org.glassfish.hk2.api.IterableProvider.qualifiedWith.

A set of qualifiers to further restrict this iterator to.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.jvnet.hk2.internal back to summary

private Class IterableProviderImpl.HandleIterable<U>

extends Object
implements Iterable<ServiceHandle<U>>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable

Field Summary

Modifier and TypeField and Description
private final List<ServiceHandle<U>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Iterator<ServiceHandle<U>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlesback to summary
private final List<ServiceHandle<U>> handles

Constructor Detail

HandleIterableback to summary
private HandleIterable(List<ServiceHandle<U>> handles)

Method Detail

iteratorback to summary
public Iterator<ServiceHandle<U>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override
org.jvnet.hk2.internal back to summary

private Class IterableProviderImpl.MyHandleIterator<U>

extends Object
implements Iterator<ServiceHandle<U>>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final LinkedList<ServiceHandle<U>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public ServiceHandle<U>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlesback to summary
private final LinkedList<ServiceHandle<U>> handles

Constructor Detail

MyHandleIteratorback to summary
private MyHandleIterator(List<ServiceHandle<U>> handles)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
nextback to summary
public ServiceHandle<U> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
org.jvnet.hk2.internal back to summary

private Class IterableProviderImpl.MyIterator<U>

extends Object
implements Iterator<U>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final LinkedList<ServiceHandle<U>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public U
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlesback to summary
private final LinkedList<ServiceHandle<U>> handles

Constructor Detail

MyIteratorback to summary
private MyIterator(List<ServiceHandle<U>> handles)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Annotations
@Override
nextback to summary
public U next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override