Class PermissionGroup.Builder
java.lang.Object
eu.cloudnetservice.driver.permission.PermissionGroup.Builder
- Enclosing class:
- PermissionGroup
A builder for permission groups.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddGroup(@NonNull PermissionGroup group) Adds the given group to the parent groups of the permission group.addPermission(@NonNull Permission permission) Adds the given permission to the permissions of the group.build()Constructs the new permission group from this builder.Sets the color of the permission group.defaultGroup(boolean defaultGroup) Sets whether the permission group is the default group or not.Sets the display of the permission group.groupPermissions(@NonNull Map<String, Set<Permission>> groupPermissions) Sets the group permissions of the permission group.groups(@NonNull Collection<String> groups) Sets the parent groups of the permission group.Sets the required name of the permission group.permissions(@NonNull Collection<Permission> permissions) Sets the permissions of the permission group.potency(int potency) Sets the potency of the permission group.Sets the prefix of the permission group.properties(@NonNull eu.cloudnetservice.common.document.gson.JsonDocument properties) Sets the properties of the permission group.sortId(int sortId) Sets the sort id of the permission group.Sets the suffix of the permission group.
-
Field Details
-
name
-
potency
private int potency -
color
-
prefix
-
suffix
-
display
-
sortId
private int sortId -
defaultGroup
private boolean defaultGroup -
groups
-
permissions
-
properties
private eu.cloudnetservice.common.document.gson.JsonDocument properties -
groupPermissions
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the required name of the permission group.- Parameters:
name- the name of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given name is null.
-
potency
Sets the potency of the permission group.- Parameters:
potency- the potency of the new group.- Returns:
- the same instance as used to call the method, for chaining.
-
color
Sets the color of the permission group.- Parameters:
color- the color of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given color is null.
-
prefix
Sets the prefix of the permission group.- Parameters:
prefix- the prefix of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given prefix is null.
-
suffix
Sets the suffix of the permission group.- Parameters:
suffix- the suffix of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given suffix is null.
-
display
Sets the display of the permission group.- Parameters:
display- the display of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given display is null.
-
sortId
Sets the sort id of the permission group.- Parameters:
sortId- the sort id of the new group.- Returns:
- the same instance as used to call the method, for chaining.
-
defaultGroup
Sets whether the permission group is the default group or not.- Parameters:
defaultGroup- whether the permission group is the default group or not.- Returns:
- the same instance as used to call the method, for chaining.
-
addGroup
Adds the given group to the parent groups of the permission group.- Parameters:
group- the parent group to add.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given group is null.
-
groups
@NonNull public @NonNull PermissionGroup.Builder groups(@NonNull @NonNull Collection<String> groups) Sets the parent groups of the permission group.- Parameters:
groups- the parent groups of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given group collection is null.
-
addPermission
@NonNull public @NonNull PermissionGroup.Builder addPermission(@NonNull @NonNull Permission permission) Adds the given permission to the permissions of the group.- Parameters:
permission- the permission to add.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given permission is null.
-
permissions
@NonNull public @NonNull PermissionGroup.Builder permissions(@NonNull @NonNull Collection<Permission> permissions) Sets the permissions of the permission group.- Parameters:
permissions- the permissions of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given permissions are null.
-
groupPermissions
@NonNull public @NonNull PermissionGroup.Builder groupPermissions(@NonNull @NonNull Map<String, Set<Permission>> groupPermissions) Sets the group permissions of the permission group.- Parameters:
groupPermissions- the group permissions for the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given group permissions are null.
-
properties
@NonNull public @NonNull PermissionGroup.Builder properties(@NonNull @NonNull eu.cloudnetservice.common.document.gson.JsonDocument properties) Sets the properties of the permission group.- Parameters:
properties- the properties of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given properties are null.
-
build
Constructs the new permission group from this builder.- Returns:
- the new permission group.
- Throws:
NullPointerException- if the name is missing.
-