Record Class ModuleEnableEvent
java.lang.Object
java.lang.Record
net.flectone.pulse.model.event.module.ModuleEnableEvent
- Record Components:
cancelled- whether a listener vetoed the changemodule- the module being enabled
- All Implemented Interfaces:
Event, ModuleEvent
public record ModuleEnableEvent(boolean cancelled, ModuleSimple module)
extends Record
implements ModuleEvent
Fired before a module is switched on. Cancelling it keeps the module off.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionModuleEnableEvent(boolean cancelled, ModuleSimple module) Creates an instance of aModuleEnableEventrecord class.ModuleEnableEvent(ModuleSimple module) Creates an event that has not been cancelled. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thecancelledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.module()Returns the value of themodulerecord component.final StringtoString()Returns a string representation of this record class.withCancelled(boolean cancelled) Returns a copy of this event with the cancelled flag set.withModule(ModuleSimple module) Returns a copy of this event for a different module.
-
Constructor Details
-
ModuleEnableEvent
Creates an event that has not been cancelled.- Parameters:
module- the module being enabled
-
ModuleEnableEvent
Creates an instance of aModuleEnableEventrecord class.
-
-
Method Details
-
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).
-
withModule
Description copied from interface:ModuleEventReturns a copy of this event for a different module.- Specified by:
withModulein interfaceModuleEvent- Parameters:
module- the new module- 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
-
module
Returns the value of themodulerecord component.- Specified by:
modulein interfaceModuleEvent- Returns:
- the value of the
modulerecord component
-