Interface Producer<I>

Type Parameters:
I - the contextual instance type
All Superinterfaces:
org.microbean.assign.Aggregate
All Known Implementing Classes:
InterceptingProducer

public interface Producer<I> extends org.microbean.assign.Aggregate
An interface whose implementations produce and commonly initialize contextual instances.

Producers are used to implement Factory instances' create(Creation) and destroy(Object, Destruction) methods.

A Producer normally initializes the contextual instances it produces as part of its produce(Creation) method implementation, but is not required to.

Author:
Laird Nelson
See Also:
  • Field Summary

    Fields inherited from interface org.microbean.assign.Aggregate

    EMPTY_ASSIGNMENTS, EMPTY_DEPENDENCIES
  • Method Summary

    Modifier and Type
    Method
    Description
    default SequencedSet<org.microbean.assign.AttributedElement>
    A convenience method that returns an immutable, determinate SequencedSet of AttributedElements consisting of this Producer's production dependencies followed by its initialization dependencies.
    default void
    Disposes of the supplied contextual instance.
    SequencedSet<org.microbean.assign.AttributedElement>
    Returns an immutable, determinate SequencedSet of AttributedElements representing dependencies required for initialization.
    default I
    Produces a new contextual instance and returns it by calling the produce(Id, SequencedSet) method with the return value of an invocation of the Aggregate.assign(Function) method with a reference to the supplied Creation's reference(AttributedType) method.
    produce(Id id, SequencedSet<? extends org.microbean.assign.Assignment<?>> assignments)
    Produces a new contextual instance and returns it, possibly (often) making use of the supplied assignments.
    SequencedSet<org.microbean.assign.AttributedElement>
    Returns an immutable, determinate SequencedSet of AttributedElements representing dependencies required for production.

    Methods inherited from interface org.microbean.assign.Aggregate

    assign