Enum Class ActorRole

java.lang.Object
java.lang.Enum<ActorRole>
de.gustavblass.fsu.fmi.roombooking.model.actor.ActorRole
All Implemented Interfaces:
Serializable, Comparable<ActorRole>, Constable

public enum ActorRole extends Enum<ActorRole>

Classification of Actors by their position at FMI. Sorted by priority (descending):

  • Enum Constant Details

  • Field Details

    • role

      public final String role
  • Constructor Details

    • ActorRole

      private ActorRole(@NonNull @NonNull String role)
  • Method Details

    • values

      public static ActorRole[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ActorRole valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • toActorAuthority

      @Contract(pure=true) @NonNull public @NonNull ActorAuthority toActorAuthority()

      Converts this ActorRole to its corresponding ActorAuthority:

      Returns:
      The ActorAuthority associated with this ActorRole.
    • toGrantedAuthority

      @Contract(pure=true) @NonNull public @NonNull org.springframework.security.core.GrantedAuthority toGrantedAuthority()
      Creates a new SimpleGrantedAuthority by prepending ROLE_ to the toActorAuthority() result. This tells the Spring framework that the GrantedAuthority is a role (see the documentation).
      Returns:
      The GrantedAuthority representing this role.
    • ofName

      @Contract(pure=true) @NonNull public static @NonNull Optional<ActorRole> ofName(String name)
      Converts the given label to the matching enum value.
      Parameters:
      name - A String suspected to be an enum value.
      Returns:
      The corresponding enum value if the given label matches one.
    • ofActorAuthority

      @Contract(pure=true) @NonNull public static @NonNull ActorRole ofActorAuthority(@NonNull @NonNull ActorAuthority actorAuthority)
      Of those ActorRoles that correspond to the given ActorAuthority, returns that role with the lowest level of authority.
      Parameters:
      actorAuthority - The authority for which to return an example role.
      Returns:
      An example role for the given authority.