Class HouseholdNameChangedEvent

java.lang.Object
no.ntnu.principes.event.PrincipesEvent<String>
no.ntnu.principes.event.HouseholdNameChangedEvent

public class HouseholdNameChangedEvent extends PrincipesEvent<String>
Event representing a change in the name of a household.

This event is triggered whenever the name of a household is updated within the domain, encapsulating the new household name. Subscribing listeners can handle this event to perform tasks such as updating related data or notifying other components.

Extends the PrincipesEvent class, carrying a String payload that contains the new household name.
  • Constructor Details

    • HouseholdNameChangedEvent

      public HouseholdNameChangedEvent(String newName)
      Creates a new HouseholdNameChangedEvent instance with the specified new household name.
      Parameters:
      newName - The new name of the household to be set in the event.
  • Method Details

    • to

      public static HouseholdNameChangedEvent to(String newName)
      Creates and returns a new HouseholdNameChangedEvent instance with the specified new household name.

      Looks cleaner with HousehouldNameChangedEvent.to("newName") than new HouseholdNameChangedEvent("newName"). Also, it is more readable and easier to understand.

      Parameters:
      newName - The new name of the household to be set in the event.
      Returns:
      A HouseholdNameChangedEvent instance encapsulating the new household name.