Package com.tangosol.net.topic
Class NamedTopicEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.tangosol.net.topic.NamedTopicEvent
-
- All Implemented Interfaces:
PortableObject
,Serializable
public class NamedTopicEvent extends EventObject implements PortableObject
An event related to aNamedTopic
.- Author:
- Jonathan Knight 2024.11.26
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NamedTopicEvent.Type
-
Field Summary
Fields Modifier and Type Field Description protected NamedTopicEvent.Type
m_type
The event's type.-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description NamedTopicEvent()
Default constructor for serialization.NamedTopicEvent(NamedTopic<?> source, NamedTopicEvent.Type type)
Create an event.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispatch(NamedTopicListener listener)
Dispatch this event to the specified MapListener.void
dispatch(Listeners listeners)
Dispatch this event to the specified listener collection.void
dispatch(Listeners listeners, boolean fStrict)
Dispatch this event to the specified listener collection.NamedTopic<?>
getSource()
NamedTopicEvent.Type
getType()
Returns the type of the event.void
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using the specified PofReader object.NamedTopicEvent
replaceSource(NamedTopic<?> source)
Create a newNamedTopicEvent
the same as this event, but with a different source.protected boolean
shouldDispatch(NamedTopicListener listener)
Return true if the providedMapListener
should receive this event.String
toString()
Return a String representation of this MapEvent object.void
writeExternal(PofWriter out)
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
-
-
-
Field Detail
-
m_type
protected NamedTopicEvent.Type m_type
The event's type.
-
-
Constructor Detail
-
NamedTopicEvent
public NamedTopicEvent()
Default constructor for serialization.
-
NamedTopicEvent
public NamedTopicEvent(NamedTopic<?> source, NamedTopicEvent.Type type)
Create an event.- Parameters:
source
- the source of the eventtype
- the type of the event
-
-
Method Detail
-
getSource
public NamedTopic<?> getSource()
- Overrides:
getSource
in classEventObject
-
getType
public NamedTopicEvent.Type getType()
Returns the type of the event.- Returns:
- the type of the event
-
readExternal
public void readExternal(PofReader in) throws IOException
Description copied from interface:PortableObject
Restore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternal
in interfacePortableObject
- Parameters:
in
- the PofReader from which to read the object's state- Throws:
IOException
- if an I/O error occurs
-
writeExternal
public void writeExternal(PofWriter out) throws IOException
Description copied from interface:PortableObject
Save the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternal
in interfacePortableObject
- Parameters:
out
- the PofWriter to which to write the object's state- Throws:
IOException
- if an I/O error occurs
-
toString
public String toString()
Return a String representation of this MapEvent object.- Overrides:
toString
in classEventObject
- Returns:
- a String representation of this MapEvent object
-
dispatch
public void dispatch(Listeners listeners)
Dispatch this event to the specified listener collection. This call is equivalent todispatch(listeners, true);
- Parameters:
listeners
- the listeners collection- Throws:
ClassCastException
- if any of the targets is not an instance of MapListener interface
-
dispatch
public void dispatch(Listeners listeners, boolean fStrict)
Dispatch this event to the specified listener collection.- Parameters:
listeners
- the listeners collectionfStrict
- if true then any RuntimeException thrown by event handlers stops all further event processing and the exception is re-thrown; if false then all exceptions are logged and the process continues- Throws:
ClassCastException
- if any of the targets is not an instance of MapListener interface
-
dispatch
public void dispatch(NamedTopicListener listener)
Dispatch this event to the specified MapListener.- Parameters:
listener
- the listener
-
shouldDispatch
protected boolean shouldDispatch(NamedTopicListener listener)
Return true if the providedMapListener
should receive this event.- Parameters:
listener
- the MapListener to dispatch this event to- Returns:
- true if the provided MapListener should receive the event
-
replaceSource
public NamedTopicEvent replaceSource(NamedTopic<?> source)
Create a newNamedTopicEvent
the same as this event, but with a different source.- Parameters:
source
- the new event source- Returns:
- a new
NamedTopicEvent
the same as this event, but with a different source - Throws:
NullPointerException
- if thesource
parameter isnull
-
-