Interface Request<I>

Type Parameters:
I - the type of the contextual reference
All Superinterfaces:
Creation<I>

public interface Request<I> extends Creation<I>
A request for a contextual reference of a particular attributed type, along with functionality to help fulfil the request.
Author:
Laird Nelson
See Also:
  • Method Details

    • beanReduction

      Returns the BeanReduction describing this Request in progress.
      Returns:
      the BeanReduction describing this Request in progress, or null if this is the primordial request
      See Also:
      Idempotency:
      Implementations of this method must be idempotent and deterministic.
      Nullability:
      Implementations of this method may return null, but only to represent the primordial request.
      Thread Safety:
      Implementations of this method must be safe for concurrent use by multiple threads.
    • child

      <J> Request<J> child(BeanReduction<J> beanReduction)
      Returns a Request that is conceptually a child of this Request and that represents a request for a contextual reference satisfying the supplied BeanReduction.

      If the supplied BeanReduction is equal to the return value of an invocation of this Request's beanReduction() method, it is permissible for this Request to be returned instead of a new child.

      Type Parameters:
      J - the type of contextual reference returned by the child Request
      Parameters:
      beanReduction - a BeanReduction; must not be null
      Returns:
      a Request that is conceptually a child of this Request and that represents a request for a contextual reference satisfying the supplied BeanReduction; never null
      Throws:
      NullPointerException - if beanReduction is null
    • primordial

      default boolean primordial()
      Returns true if and only if this Request implementation is the primordial request.

      The default implementation of this method returns true if and only if the return value of an invocation of the beanReduction() method is null.

      Returns:
      true if and only if this Request is the primordial request
    • reference

      default <R> R reference(AttributedType attributedType)
      Acquires a contextual reference that matches the supplied AttributedType and returns it.
      Type Parameters:
      R - the type of contextual reference
      Parameters:
      attributedType - an AttributedType; must not be null
      Returns:
      a contextual reference, which may be null
      Throws:
      NullPointerException - if attributedtype is null
    • reference

      <R> R reference(AttributedType attributedType, Bean<R> bean, Creation<R> creation)
      Returns a contextual reference that matches the supplied AttributedType, using the supplied Bean to disambiguate otherwise ambiguous contextual reference selections.
      Type Parameters:
      R - the type of contextual reference
      Parameters:
      attributedType - an AttributedType; must not be null
      bean - a Bean that can be used to disambiguate otherwise ambiguous contextual reference selections; may (commonly) be null if the caller expects there to be no ambiguity
      creation - a Creation; must not be null
      Returns:
      a contextual reference; never null
      Throws:
      NullPointerException - if attributedType or creation is null
    • reference

      default <R> R reference(AttributedType attributedType, Creation<R> creation)
      Returns a contextual reference that matches the supplied AttributedType.
      Type Parameters:
      R - the type of contextual reference
      Parameters:
      attributedType - an AttributedType; must not be null
      creation - a Creation; must not be null
      Returns:
      a contextual reference; never null
      Throws:
      NullPointerException - if attributedType or creation is null