Interface ReferencesSelector
- All Known Subinterfaces:
Creation<I>, Destruction, References<R>
public interface ReferencesSelector
A supplier of
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()default <R> RDeprecated.default <R> Rreference(Annotated<? extends AnnotatedConstruct> aac) A convenience method that acquires and returns what is presumed, possibly incorrectly, to be the sole contextual reference compatible with the suppliedAnnotated<? extends AnnotatedConstruct>.<R> RReturns a non-null, determinate, contextual reference appropriate for the suppliedBean.default <R> References<R> Deprecated.Please use thereferences(Annotated)method instead.<R> References<R> references(Annotated<? extends AnnotatedConstruct> aac) Returns a non-null, determinateReferencescapable of locating contextual references compatible with the suppliedAnnotated<? extends AnnotatedConstruct>.
-
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 a non-nullDomainthat can be used to furnishAnnotatedConstructs.Implementations of this method must be safe for concurrent use by multiple threads.
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(Annotated)method, since you need aDomainto make anAnnotated<? extends AnnotatedConstruct>.- Returns:
- a non-
nullDomain - See Also:
-
reference
Returns a non-null, determinate, contextual reference 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, must ensure that ultimately the supplied
Bean's affiliatedFactoryis the mechanism used, and no other is used, to create any contextual instance underlying the contextual reference to be returned.- Type Parameters:
R- the contextual reference type- Parameters:
bean- a non-nullBean- Returns:
- a non-
null, determinate, contextual reference appropriate for the suppliedBean - Throws:
NullPointerException- ifbeanisnullIllegalArgumentException- ifbeanis unsuitable in any way
-
references
Returns a non-null, determinateReferencescapable of locating contextual references compatible with the suppliedAnnotated<? extends AnnotatedConstruct>.- Type Parameters:
R- the contextual reference type- Parameters:
aac- a non-nullAnnotated<? extends AnnotatedConstruct>describing the putative contextual reference; must represent<R>- Returns:
- a non-
null, determinateReferences - Throws:
NullPointerException- ifaacisnullIllegalArgumentException- ifaacis unsuitable in any way- See Also:
-
references
Deprecated.Please use thereferences(Annotated)method instead.Returns a non-null, determinateReferencescapable of locating contextual references compatible with the suppliedAnnotatedConstruct.- Type Parameters:
R- the contextual reference type- Parameters:
ac- a non-nullAnnotatedConstructdescribing the putative contextual reference; must represent<R>- Returns:
- a non-
null, determinateReferences - Throws:
NullPointerException- ifacisnullIllegalArgumentException- ifacis unsuitable in any way- See Also:
-
reference
Deprecated.Please use thereference(Annotated)method instead.A convenience method that acquires and returns what is presumed, possibly incorrectly, to be the sole contextual reference compatible with the suppliedAnnotatedConstruct.- Type Parameters:
R- the contextual reference type- Parameters:
ac- a non-nullAnnotatedConstructdescribing the putative contextual reference; must represent<R>- Returns:
- a non-
null, determinate contextual reference - Throws:
NullPointerException- ifacisnullUnsatisfiedResolutionException- if there is no compatible contextual referenceAmbiguousResolutionException- if there is more than one compatible contextual reference- See Also:
-
reference
A convenience method that acquires and returns what is presumed, possibly incorrectly, to be the sole contextual reference compatible with the suppliedAnnotated<? extends AnnotatedConstruct>.- Type Parameters:
R- the contextual reference type- Parameters:
aac- a non-nullAnnotated<? extends AnnotatedConstruct>describing the putative contextual reference; must represent<R>- Returns:
- a non-
null, determinate contextual reference - Throws:
NullPointerException- ifaacisnullUnsatisfiedResolutionException- if there is no compatible contextual referenceAmbiguousResolutionException- if there is more than one compatible contextual reference- See Also:
-
reference(Annotated)method instead.