Class InterceptingProducer<I>
java.lang.Object
org.microbean.producer.InterceptingProducer<I>
-
Field Summary
Fields inherited from interface org.microbean.bean.Aggregate
EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES -
Constructor Summary
ConstructorsConstructorDescriptionInterceptingProducer(Domain domain, Producer<I> delegate, InterceptionProxier proxier) Creates a newInterceptingProducer. -
Method Summary
Modifier and TypeMethodDescriptionSequencedSet<? extends Assignment<?>> assign(Function<? super AttributedType, ?> f) final SequencedSet<AttributedElement> A convenience method that returns an immutable, determinateSequencedSetofAttributedElements consisting of thisProducer's production dependencies followed by its initialization dependencies.final voiddispose(I i, Destruction d) Disposes of the supplied contextual instance.Returns an immutable, determinateSequencedSetofAttributedElements representing dependencies required for initialization.final IProduces a new contextual instance and returns it by calling theProducer.produce(Id, SequencedSet)method with the return value of an invocation of theAggregate.assign(Function)method with a reference to the suppliedCreation'sreference(AttributedType)method.produce(Id id, SequencedSet<? extends Assignment<?>> assignments) Produces a new contextual instance and returns it, possibly (often) making use of the supplied assignments.Returns an immutable, determinateSequencedSetofAttributedElements representing dependencies required for production.
-
Constructor Details
-
InterceptingProducer
Creates a newInterceptingProducer.- Parameters:
domain- aDomain; must not benulldelegate- aProducerto which ultimate production will be delegated; must not benullproxier- anInterceptionProxier; must not benull- Throws:
NullPointerException- if any argument isnull
-
-
Method Details
-
dependencies
Description copied from interface:ProducerA convenience method that returns an immutable, determinateSequencedSetofAttributedElements consisting of thisProducer's production dependencies followed by its initialization dependencies.There is normally no need to override the default implementation of this method.
- Specified by:
dependenciesin interfaceAggregate- Specified by:
dependenciesin interfaceProducer<I>- Returns:
- a non-
null, immutable, determinateSequencedSetofAttributedElements consisting of thisProducer's production dependencies followed by its initialization dependencies - See Also:
-
dispose
Description copied from interface:ProducerDisposes of the supplied contextual instance.The default implementation of this method checks to see if
iis an instance ofAutoCloseable, and, if so, callsclose()on it, throwing any resulting exception as aDisposalException. -
produce
Description copied from interface:ProducerProduces a new contextual instance and returns it by calling theProducer.produce(Id, SequencedSet)method with the return value of an invocation of theAggregate.assign(Function)method with a reference to the suppliedCreation'sreference(AttributedType)method. -
assign
-
initializationDependencies
Description copied from interface:ProducerReturns an immutable, determinateSequencedSetofAttributedElements representing dependencies required for initialization.Such dependencies may represent initialization method parameters and/or fields.
Contrast initialization dependencies with production dependencies.
- Specified by:
initializationDependenciesin interfaceProducer<I>- Returns:
- a non-
null, immutable, determinateSequencedSetofAttributedElements representing dependencies required for initialization - See Also:
-
produce
Description copied from interface:ProducerProduces a new contextual instance and returns it, possibly (often) making use of the supplied assignments.Implementations of this method must not call
Producer.produce(Creation)or an infinite loop may result.- Specified by:
producein interfaceProducer<I>- Parameters:
id- anIdfor which production is occurring; must not benullassignments- aSequencedSetofAssignments thisProducerneeds to complete production and possibly initialization; must not benull- Returns:
- a new contextual instance, or
null
-
productionDependencies
Description copied from interface:ProducerReturns an immutable, determinateSequencedSetofAttributedElements representing dependencies required for production.Such dependencies normally represent constructor parameters.
Contrast production dependencies with initialization dependencies.
- Specified by:
productionDependenciesin interfaceProducer<I>- Returns:
- a non-
null, immutable, determinateSequencedSetofAttributedElements representing dependencies required for production - See Also:
-