Class InterceptingProducer<I>
java.lang.Object
org.microbean.bean.InterceptingProducer<I>
- Type Parameters:
I
- the type of contextual instance
A
Producer
that applies constructor interception to produce contextual instances.- Author:
- Laird Nelson
- See Also:
-
Field Summary
Fields inherited from interface org.microbean.bean.Aggregate
EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES
-
Constructor Summary
ConstructorsConstructorDescriptionInterceptingProducer
(Collection<? extends org.microbean.interceptor.InterceptorMethod> interceptorMethods, Producer<I> producer) Creates a newInterceptingProducer
. -
Method Summary
Modifier and TypeMethodDescriptionfinal SequencedSet
<? extends Assignment<?>> Calls theassign(Request)
method on theProducer
supplied at construction time with the suppliedRequest
and returns the result.final SequencedSet
<AttributedElement> Calls thedependencies()
method on theProducer
supplied at construction time and returns the result.final void
Calls thedispose(Object, Request)
method on theProducer
supplied at construction time with the suppliedi
and the suppliedRequest
.final I
produce
(SequencedSet<? extends Assignment<?>> assignments) Calls theproduce(SequencedSet)
method on theProducer
supplied at construction time with the suppliedassignments
and returns the result.final I
Produces a potentially uninitialized contextual instance and returns it, using theCollection
ofInterceptorMethod
s supplied at construction time to intercept the production.
-
Constructor Details
-
InterceptingProducer
public InterceptingProducer(Collection<? extends org.microbean.interceptor.InterceptorMethod> interceptorMethods, Producer<I> producer) Creates a newInterceptingProducer
.- Parameters:
interceptorMethods
- aCollection
ofInterceptorMethod
s; must not benull
producer
- a subordinateProducer
to which are delegated theassign(Request)
,dependencies()
,dispose(Object, Request)
andproduce(SequencedSet)
operations; must not benull
- Throws:
NullPointerException
- if either argument isnull
-
-
Method Details
-
assign
Calls theassign(Request)
method on theProducer
supplied at construction time with the suppliedRequest
and returns the result.- Specified by:
assign
in interfaceAggregate
- Parameters:
r
- aRequest
; must not benull
- Returns:
- the result of calling the
assign(Request)
method on theProducer
supplied at construction time; nevernull
- Throws:
NullPointerException
- ifr
isnull
- See Also:
-
dependencies
Calls thedependencies()
method on theProducer
supplied at construction time and returns the result.- Specified by:
dependencies
in interfaceAggregate
- Returns:
- the result of calling the
dependencies()
method on theProducer
supplied at construction time; nevernull
- See Also:
-
dispose
Calls thedispose(Object, Request)
method on theProducer
supplied at construction time with the suppliedi
and the suppliedRequest
.- Specified by:
dispose
in interfaceProducer<I>
- Parameters:
i
- a contextual instance produced by thisInterceptingProducer
; may benull
r
- aRequest
; must not benull
- Throws:
NullPointerException
- ifr
isnull
- See Also:
-
produce
Produces a potentially uninitialized contextual instance and returns it, using theCollection
ofInterceptorMethod
s supplied at construction time to intercept the production.- Specified by:
produce
in interfaceProducer<I>
- Parameters:
r
- aRequest
; must not benull
- Returns:
- a contextual instance, which may be
null
- Throws:
NullPointerException
- ifr
isnull
- See Also:
-
produce
Calls theproduce(SequencedSet)
method on theProducer
supplied at construction time with the suppliedassignments
and returns the result.- Specified by:
produce
in interfaceProducer<I>
- Parameters:
assignments
- aSequencedSet
ofAssignment
s; must not benull
- Returns:
- a new contextual instance, or
null
- Throws:
NullPointerException
- ifassignments
isnull
- See Also:
-