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.Default
Nested classes/interfaces inherited from interface org.jgrapes.core.Subchannel
Subchannel.DefaultSubchannel
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultSubchannel
(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, wait
Methods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGet
Methods 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:Subchannel
Returns the main channel.- Specified by:
mainChannel
in 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:
setAssociated
in 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:
associated
in 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
-