Package org.jgrapes.core
Class Subchannel.DefaultSubchannel
java.lang.Object
org.jgrapes.core.Subchannel.DefaultSubchannel
- All Implemented Interfaces:
Associator,Channel,Eligible,Subchannel
- Direct Known Subclasses:
ConnectionManager.Connection,IOSubchannel.DefaultIOSubchannel
- Enclosing interface:
Subchannel
A simple implementation of
Subchannel.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.DefaultNested classes/interfaces inherited from interface org.jgrapes.core.Subchannel
Subchannel.DefaultSubchannel -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSubchannel(Channel mainChannel) Creates a new instance with the given main channel and response pipeline. -
Method Summary
Modifier and TypeMethodDescription<V> Optional<V> associated(Object by, Class<V> type) Retrieves the associated object following the association with the given “name”.Returns the main channel.<A extends Associator>
AsetAssociated(Object by, Object with) Establishes a “named” association to an associated object.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGetMethods inherited from interface org.jgrapes.core.Subchannel
defaultCriterion, isEligibleFor
-
Constructor Details
-
DefaultSubchannel
Creates a new instance with the given main channel and response pipeline.- Parameters:
mainChannel- the main channel
-
-
Method Details
-
mainChannel
Description copied from interface:SubchannelReturns the main channel.- Specified by:
mainChannelin interfaceSubchannel- 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:
setAssociatedin interfaceAssociator- Type Parameters:
A- the associator’s type- Parameters:
by- the “name”with- the object to be associated- Returns:
- the sub channel for easy chaining
-
associated
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:
associatedin interfaceAssociator- 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
-