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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 forHandlerannotations. -
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.booleanisEligibleFor(Object value) Matches the object itself (using identity comparison) or theChannelclass.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, unregisterAsGeneratorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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.SELFcan 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 forHandlerannotations.- 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 thechannelselements of theHandlerannotations
-
-
Method Details
-
setName
Description copied from interface:ManagerSets the (optional) name of the component.- Specified by:
setNamein interfaceManager- Overrides:
setNamein classComponentVertex- Parameters:
name- the name to set- Returns:
- the component (for comfortable chaining)
-
component
Description copied from class:ComponentVertexReturns the component represented by this node in the tree.- Specified by:
componentin interfaceManager- Specified by:
componentin classComponentVertex- Returns:
- the component
-
channel
Returns the channel associated with the component. -
defaultCriterion
Return the object itself as value.- Specified by:
defaultCriterionin interfaceEligible- Returns:
- the criterion
-
isEligibleFor
Matches the object itself (using identity comparison) or theChannelclass.- Specified by:
isEligibleForin interfaceChannel- Specified by:
isEligibleForin interfaceEligible- Parameters:
value- the criterion- Returns:
- true, if is eligible for
- See Also:
-