Class Subchannel.DefaultSubchannel

java.lang.Object
org.jgrapes.core.Subchannel.DefaultSubchannel
All Implemented Interfaces:
Associator, Channel, Eligible, Subchannel
Direct Known Subclasses:
IOSubchannel.DefaultIOSubchannel
Enclosing interface:
Subchannel

public static class Subchannel.DefaultSubchannel extends Object implements Subchannel
A simple implementation of Subchannel.
  • Constructor Details

    • DefaultSubchannel

      public DefaultSubchannel(Channel mainChannel)
      Creates a new instance with the given main channel and response pipeline.
      Parameters:
      mainChannel - the main channel
  • Method Details

    • mainChannel

      public Channel mainChannel()
      Description copied from interface: Subchannel
      Returns the main channel.
      Specified by:
      mainChannel in interface Subchannel
      Returns:
      the mainChannel
    • setAssociated

      Establishes a “named” association to an associated object.

      Note that anything that represents an id can be used as value for parameter name, it does not necessarily have to be a string.

      Specified by:
      setAssociated in interface Associator
      Parameters:
      by - the “name”
      with - the object to be associated
      Returns:
      the sub channel for easy chaining
    • associated

      public <V> Optional<V> associated(Object by, Class<V> type)
      Retrieves the associated object following the association with the given “name”.

      This general version of the method supports the retrieval of values of arbitrary types associated by any “name” types.

      Specified by:
      associated in interface Associator
      Type Parameters:
      V - the type of the value to be retrieved
      Parameters:
      by - the “name”
      type - the tape of the value to be retrieved
      Returns:
      the associate, if any
    • toString

      public String toString()
      Overrides:
      toString in class Object