Class EventChannelRegister

java.lang.Object
org.nanonative.nano.helper.event.EventChannelRegister

public class EventChannelRegister extends Object
  • Method Details

    • registerChannelId

      public static int registerChannelId(String channelName)
      Registers a new event type with a given name if it does not already exist. If the event type already exists, it returns the existing event type's ID.
      Parameters:
      channelName - The name of the event type to register.
      Returns:
      The ID of the newly registered event type, or the ID of the existing event type if it already exists. Returns -1 if the input is null or empty.
    • eventNameOf

      public static String eventNameOf(int channelId)
      Retrieves the name of an event type given its ID.
      Parameters:
      channelId - The ID of the event type.
      Returns:
      The name of the event type associated with the given ID, or null if not found.
    • eventIdOf

      public static Optional<Integer> eventIdOf(String channelName)
      Attempts to find the ID of an event type based on its name. This method is primarily used for debugging or startup purposes and is not optimized for performance.
      Parameters:
      channelName - The name of the event type.
      Returns:
      An Optional containing the ID of the event type if found, or empty if not found or if the input is null or empty.
    • isChannelIdAvailable

      public static boolean isChannelIdAvailable(int channelId)
      Checks if an event type with the given ID exists.
      Parameters:
      channelId - The ID of the event type to check.
      Returns:
      true if an event type with the given ID exists, false otherwise.