Record Class MessageFormattingEvent
java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.message.MessageFormattingEvent
- Record Components:
cancelled- whether a listener vetoed the formattingcontext- the message being formatted
- All Implemented Interfaces:
Event
public record MessageFormattingEvent(boolean cancelled, MessageContext context)
extends Record
implements Event
Fired while a message is being turned into a component, so listeners can adjust the text or its tags.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionMessageFormattingEvent(boolean cancelled, MessageContext context) Creates an instance of aMessageFormattingEventrecord class.MessageFormattingEvent(MessageContext context) Creates an event that has not been cancelled. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelledrecord component.context()Returns the value of thecontextrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.withCancelled(boolean cancelled) Returns a copy of this event with the cancelled flag set.withContext(MessageContext context) Returns a copy carrying a different context, or this event if the context is unchanged.
-
Constructor Details
-
MessageFormattingEvent
Creates an event that has not been cancelled.- Parameters:
context- the message being formatted
-
MessageFormattingEvent
Creates an instance of aMessageFormattingEventrecord class.
-
-
Method Details
-
withContext
Returns a copy carrying a different context, or this event if the context is unchanged.- Parameters:
context- the new context- Returns:
- the copy, or this instance when nothing changed
-
withCancelled
Description copied from interface:EventReturns a copy of this event with the cancelled flag set.- Specified by:
withCancelledin interfaceEvent- Parameters:
cancelled- the new cancelled state- Returns:
- a clone of this object, except with this updated property (returns
thisif an identical value is passed).
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
cancelled
-
context
-