Package com.jgcomptech.tools.authc
Class UserRole.Builder
- java.lang.Object
-
- com.jgcomptech.tools.authc.UserRole.Builder
-
- Enclosing class:
- UserRole
public class UserRole.Builder extends java.lang.ObjectA builder class to be used to modify UserRoles.- Since:
- 1.5.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UserRole.Builderadd(java.lang.String name)Adds the specified permission to the user role.UserRole.Builderadd(java.lang.String... names)Adds the specified permissions to the user role.UserRole.BuilderaddImplicit(java.lang.String name)Implicitly adds the specified permission to the user role even if it is already inherited.UserRole.BuilderaddImplicit(java.lang.String... names)Implicitly adds the specified permissions to the user role even if they are already inherited.booleanequals(java.lang.Object o)inthashCode()UserRole.Builderremove(java.lang.String name)Removes the specified permission from the user role.UserRole.Builderremove(java.lang.String... names)Removes the specified permissions from the user role.java.lang.StringtoString()
-
-
-
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 addedjava.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 addedjava.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 addedjava.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 addedjava.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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-