T- the registration key for the component; usually an interface
@ExperimentalApi public class ComponentReference<T> extends Object implements java.util.function.Supplier<T>, Supplier<T>, Serializable
Note that this is both serializable and thread-safe. However, it will only resolve components
that were registered with the component class provided in the constructor; you can not specify
some other interface as with
ComponentAccessor.getComponentOfType(Class) or reference
OSGi services as with
is a good thing; you should be using the proper registration key, anyway.
get() method may be re-entered and multiple threads
are permitted to resolve the reference if necessary. On the other hand, it also cannot deadlock,
LazyReference will do (in versions prior to 2.5.0) if a single thread attempts to
re-enter it due to circular logic. Since circular logic using this class will return to the
ComponentAccessor and eventually to Pico, the container's normal dependency loop
detection is applied at the time the component is requested, which means you'll get told what
the circular path was.
|Modifier and Type||Method and Description|
Dependency references are equal iff they are references for the same
Produce an object.
public T get()
public final boolean equals(Object o)
Copyright © 2002-2021 Atlassian. All Rights Reserved.