Class RoleMap

java.lang.Object
com.codingchili.core.protocol.RoleMap

public class RoleMap extends Object
Add custom roles to the rolemap, must be done before initializing protocols. By mapping the name of the role to an instance annotations are no longer limited to the default roles in #Role.
  • Field Details

  • Constructor Details

    • RoleMap

      public RoleMap()
  • Method Details

    • put

      public static void put(String name, RoleType role)
      Adds a role mapping.
      Parameters:
      name - the name of the role.
      role - the role implementation.
    • get

      public static RoleType get(String name)
      retrieves a role by its name.
      Parameters:
      name - the name of the role to retrieve.
      Returns:
      a registered role that matches the given name, throws an exception if the role is not registered.
    • get

      public static RoleType[] get(String... names)
      Parameters:
      names - multiple names to retrieve the roles for.
      Returns:
      a list of roles that matches the given list. Throws an exception if any of the roles in the given names is not registered.