Class UserRole.Builder

  • Enclosing class:
    UserRole

    public class UserRole.Builder
    extends java.lang.Object
    A builder class to be used to modify UserRoles.
    Since:
    1.5.0
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder​(UserRole role)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UserRole.Builder add​(java.lang.String name)
      Adds the specified permission to the user role.
      UserRole.Builder add​(java.lang.String... names)
      Adds the specified permissions to the user role.
      UserRole.Builder addImplicit​(java.lang.String name)
      Implicitly adds the specified permission to the user role even if it is already inherited.
      UserRole.Builder addImplicit​(java.lang.String... names)
      Implicitly adds the specified permissions to the user role even if they are already inherited.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      UserRole.Builder remove​(java.lang.String name)
      Removes the specified permission from the user role.
      UserRole.Builder remove​(java.lang.String... names)
      Removes the specified permissions from the user role.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Builder

        public Builder​(UserRole role)
    • Method Detail

      • add

        public UserRole.Builder add​(java.lang.String name)
        Adds the specified permission to the user role.
        Parameters:
        name - the name of the permission to add
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permission failed to be added
        java.lang.IllegalArgumentException - if attempting to add to the NONE system role
      • add

        public UserRole.Builder add​(java.lang.String... names)
        Adds the specified permissions to the user role.
        Parameters:
        names - the names of the permissions to add
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permissions failed to be added
        java.lang.IllegalArgumentException - if attempting to add to the NONE system role
      • addImplicit

        public UserRole.Builder addImplicit​(java.lang.String name)
        Implicitly adds the specified permission to the user role even if it is already inherited.
        Parameters:
        name - the name of the permission to add
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permission failed to be added
        java.lang.IllegalArgumentException - if attempting to add to the NONE system role
        Since:
        1.5.0
      • addImplicit

        public UserRole.Builder addImplicit​(java.lang.String... names)
        Implicitly adds the specified permissions to the user role even if they are already inherited.
        Parameters:
        names - the name of the permissions to add
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permission failed to be added
        java.lang.IllegalArgumentException - if attempting to add to the NONE system role
        Since:
        1.5.0
      • remove

        public UserRole.Builder remove​(java.lang.String name)
        Removes the specified permission from the user role. Inherited permissions are not removed.
        Parameters:
        name - the name of the permission to remove
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permission failed to be removed
      • remove

        public UserRole.Builder remove​(java.lang.String... names)
        Removes the specified permissions from the user role. Inherited permissions are not removed.
        Parameters:
        names - the names of the permissions to remove
        Returns:
        the current instance of the builder
        Throws:
        java.lang.IllegalStateException - if permissions failed to be removed
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object