Interface ReferencesSelector
- All Known Subinterfaces:
Creation<I>, Destruction, References<R>
References objects.- Author:
- Laird Nelson
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDestroys the supplied contextual reference if and only if it meets the conditions for destruction.domain()Returns aDomainthat can be used to produceTypeMirrors so thatAttributedTypeinstances used by thereferences(AttributedType)andreference(AttributedType)methods may be created.default <R> RA convenience method that acquires and returns what is presumed, possibly incorrectly, to be the sole contextual reference of the relevant type.<R> RReturns a contextual reference of the relevant type appropriate for the suppliedBean.<R> References<R> Returns aReferencescapable of locating contextual references of the relevant type.
-
Method Details
-
destroy
Destroys the supplied contextual reference if and only if it meets the conditions for destruction.- Parameters:
r- a contextual reference; may benullin which casefalsewill be returned- Returns:
trueif and only if destruction occurred- Throws:
DestructionException- if an error occurs
-
domain
Returns aDomainthat can be used to produceTypeMirrors so thatAttributedTypeinstances used by thereferences(AttributedType)andreference(AttributedType)methods may be created.Implementations of this method must not return
null.Implementations of this method must be safe for concurrent use by multiple threads.
Implementations of this method must return a determinate value.
Design Note
Without this method, componenents using a
ReferencesSelectorwill have to arrange to have their ownDomainsomehow. Inconveniently, this is the only type in the system that cannot be acquired by an invocation of thereferences(AttributedType)method, since you need aDomainto make anAttributedType.- Returns:
- a non-
nullDomain
-
reference
Returns a contextual reference of the relevant type appropriate for the suppliedBean.Implementations of this method must be safe for concurrent use by multiple threads.
Implementations of this method must, directly or indirectly, use the supplied
Bean's affiliatedFactoryto create any contextual instance underlying the contextual reference to be returned.- Type Parameters:
R- the contextual reference type- Parameters:
bean- aBean; must not benull- Returns:
- a non-
nullcontextual reference - Throws:
NullPointerException- ifbeanisnullIllegalArgumentException- ifbeanis unsuitable in any way
-
references
Returns aReferencescapable of locating contextual references of the relevant type.- Type Parameters:
R- the contextual reference type- Parameters:
t- anAttributedTypedescribing the contextual reference type; must not benull- Returns:
- a non-
nullReferences - Throws:
NullPointerException- iftisnullIllegalArgumentException- iftis unsuitable in any way- See Also:
-
reference
A convenience method that acquires and returns what is presumed, possibly incorrectly, to be the sole contextual reference of the relevant type.- Type Parameters:
R- the contextual reference type- Parameters:
t- anAttributedTypedescribing the contextual reference type; must not benull- Returns:
- a non-
nullcontextual reference - Throws:
NullPointerException- iftisnullUnsatisfiedResolutionException- if there is no contextual reference for the relevant typeAmbiguousResolutionException- if there is more than one contextual reference for the relevant type- See Also:
-