Enum Role

  • All Implemented Interfaces:
    Serializable, Comparable<Role>

    public enum Role
    extends Enum<Role>
    A temporary position or privilege level within a room, distinct from a user's long-lived affiliation with the room; the possible roles are "moderator", "participant", and "visitor" (it is also possible to have no defined role). A role lasts only for the duration of an occupant's visit to a room.
    See Also:
    5.1 Roles
    • Enum Constant Detail

      • MODERATOR

        public static final Role MODERATOR
        The moderator role.
      • PARTICIPANT

        public static final Role PARTICIPANT
        The participant role.
      • VISITOR

        public static final Role VISITOR
        The visitor role.
      • NONE

        public static final Role NONE
        No role.
    • Method Detail

      • values

        public static Role[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Role c : Role.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Role valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • isHigherThan

        public final boolean isHigherThan​(Role role)
        Compares two roles and returns true, if this role is higher than the other with regards to their privileges in a multi-user chat.

        The highest role is moderator, followed by participant, followed by visitor, followed by none.

        Parameters:
        role - The other role.
        Returns:
        True, if this role is higher than the other.