Class Group.Builder

java.lang.Object
org.apache.nifi.authorization.Group.Builder
Enclosing class:
Group

public static class Group.Builder extends Object
Builder for creating Groups.
  • Field Details

    • identifier

      private String identifier
    • name

      private String name
    • users

      private Set<String> users
    • fromGroup

      private final boolean fromGroup
  • Constructor Details

    • Builder

      public Builder()
    • Builder

      public Builder(Group other)
      Initializes the builder with the state of the provided group. When using this constructor the identifier field of the builder can not be changed and will result in an IllegalStateException if attempting to do so.
      Parameters:
      other - the existing access policy to initialize from
  • Method Details

    • identifier

      public Group.Builder identifier(String identifier)
      Sets the identifier of the builder.
      Parameters:
      identifier - the identifier
      Returns:
      the builder
      Throws:
      IllegalStateException - if this method is called when this builder was constructed from an existing Group
    • identifierGenerateRandom

      public Group.Builder identifierGenerateRandom()
      Sets the identifier of the builder to a random UUID.
      Returns:
      the builder
      Throws:
      IllegalStateException - if this method is called when this builder was constructed from an existing Group
    • identifierGenerateFromSeed

      public Group.Builder identifierGenerateFromSeed(String seed)
      Sets the identifier of the builder with a UUID generated from the specified seed string.
      Returns:
      the builder
      Throws:
      IllegalStateException - if this method is called when this builder was constructed from an existing Group
    • name

      public Group.Builder name(String name)
      Sets the name of the builder.
      Parameters:
      name - the name
      Returns:
      the builder
    • addUsers

      public Group.Builder addUsers(Set<String> users)
      Adds all users from the provided set to the builder's set of users.
      Parameters:
      users - a set of users to add
      Returns:
      the builder
    • addUser

      public Group.Builder addUser(String user)
      Adds the given user to the builder's set of users.
      Parameters:
      user - the user to add
      Returns:
      the builder
    • removeUser

      public Group.Builder removeUser(String user)
      Removes the given user from the builder's set of users.
      Parameters:
      user - the user to remove
      Returns:
      the builder
    • removeUsers

      public Group.Builder removeUsers(Set<String> users)
      Removes all users from the provided set from the builder's set of users.
      Parameters:
      users - the users to remove
      Returns:
      the builder
    • clearUsers

      public Group.Builder clearUsers()
      Clears the builder's set of users so that users is non-null with size 0.
      Returns:
      the builder
    • build

      public Group build()
      Returns:
      a new Group constructed from the state of the builder