Class Component
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
- Direct Known Subclasses:
ComponentCollector
,ComponentProvider
,ConfigurationStore
,ConnectionManager
,FileStorage
,FileSystemWatcher
,FreeMarkerRequestHandler
,HttpConnector
,HttpServer
,InputStreamMonitor
,LanguageSelector
,NioDispatcher
,ProcessManager
,PurgeTerminator
,SessionManager
,SocketConnectionManager
,SslCodec
,StaticContentDispatcher
This class implements the Manager
interface. Contrary
to classes that only implement ComponentType
, derived
classes therefore don't need a manager attribute to get access to the
component management methods provided by this interface.
This class also implements the Channel interface in such a way that each instance of this class can be used as an independent channel. Note that events that have a component as one of their channels are always handled by the component's handlers, i.e. in addition to the channels explicitly defined for a handler.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a new component base with its channel set to itself.Creates a new component base with its channel set to the given channel.Component
(Channel componentChannel, HandlerDefinition.ChannelReplacements channelReplacements) Creates a new component base likeComponent(Channel)
but with channel mappings forHandler
annotations. -
Method Summary
Modifier and TypeMethodDescriptionchannel()
Returns the channel associated with the component.Returns the component represented by this node in the tree.Return the object itself as value.boolean
isEligibleFor
(Object value) Matches the object itself (using identity comparison) or theChannel
class.Sets the (optional) name of the component.Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
logger
-
-
Constructor Details
-
Component
public Component()Creates a new component base with its channel set to itself. -
Component
Creates a new component base with its channel set to the given channel.As a special case
Channel.SELF
can be passed to the constructor to make the component use itself as channel. The special value is necessary as you obviously cannot pass an object to be constructed to its constructor.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event to
-
Component
public Component(Channel componentChannel, HandlerDefinition.ChannelReplacements channelReplacements) Creates a new component base likeComponent(Channel)
but with channel mappings forHandler
annotations.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event tochannelReplacements
- the channel replacements to apply to thechannels
elements of theHandler
annotations
-
-
Method Details
-
setName
Description copied from interface:Manager
Sets the (optional) name of the component.- Specified by:
setName
in interfaceManager
- Overrides:
setName
in classComponentVertex
- Parameters:
name
- the name to set- Returns:
- the component (for comfortable chaining)
-
component
Description copied from class:ComponentVertex
Returns the component represented by this node in the tree.- Specified by:
component
in interfaceManager
- Specified by:
component
in classComponentVertex
- Returns:
- the component
-
channel
Returns the channel associated with the component. -
defaultCriterion
Return the object itself as value.- Specified by:
defaultCriterion
in interfaceEligible
- Returns:
- the criterion
-
isEligibleFor
Matches the object itself (using identity comparison) or theChannel
class.- Specified by:
isEligibleFor
in interfaceChannel
- Specified by:
isEligibleFor
in interfaceEligible
- Parameters:
value
- the criterion- Returns:
- true, if is eligible for
- See Also:
-