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 theProducersupplied at construction time with the suppliedRequestand returns the result.final SequencedSet<AttributedElement> Calls thedependencies()method on theProducersupplied at construction time and returns the result.final voidCalls thedispose(Object, Request)method on theProducersupplied at construction time with the suppliediand the suppliedRequest.final Iproduce(SequencedSet<? extends Assignment<?>> assignments) Calls theproduce(SequencedSet)method on theProducersupplied at construction time with the suppliedassignmentsand returns the result.final IProduces a potentially uninitialized contextual instance and returns it, using theCollectionofInterceptorMethods 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- aCollectionofInterceptorMethods; must not benullproducer- a subordinateProducerto 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 theProducersupplied at construction time with the suppliedRequestand returns the result.- Specified by:
assignin interfaceAggregate- Parameters:
r- aRequest; must not benull- Returns:
- the result of calling the
assign(Request)method on theProducersupplied at construction time; nevernull - Throws:
NullPointerException- ifrisnull- See Also:
-
dependencies
Calls thedependencies()method on theProducersupplied at construction time and returns the result.- Specified by:
dependenciesin interfaceAggregate- Returns:
- the result of calling the
dependencies()method on theProducersupplied at construction time; nevernull - See Also:
-
dispose
Calls thedispose(Object, Request)method on theProducersupplied at construction time with the suppliediand the suppliedRequest.- Specified by:
disposein interfaceProducer<I>- Parameters:
i- a contextual instance produced by thisInterceptingProducer; may benullr- aRequest; must not benull- Throws:
NullPointerException- ifrisnull- See Also:
-
produce
Produces a potentially uninitialized contextual instance and returns it, using theCollectionofInterceptorMethods supplied at construction time to intercept the production.- Specified by:
producein interfaceProducer<I>- Parameters:
r- aRequest; must not benull- Returns:
- a contextual instance, which may be
null - Throws:
NullPointerException- ifrisnull- See Also:
-
produce
Calls theproduce(SequencedSet)method on theProducersupplied at construction time with the suppliedassignmentsand returns the result.- Specified by:
producein interfaceProducer<I>- Parameters:
assignments- aSequencedSetofAssignments; must not benull- Returns:
- a new contextual instance, or
null - Throws:
NullPointerException- ifassignmentsisnull- See Also:
-