Package org.kiwiproject.consul.model.acl
Class ImmutableRole
java.lang.Object
org.kiwiproject.consul.model.acl.Role
org.kiwiproject.consul.model.acl.ImmutableRole
Immutable implementation of
Role.
Use the builder to create immutable instances:
ImmutableRole.builder().
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.kiwiproject.consul.model.acl.Role
Role.RoleNodeIdentity, Role.RolePolicyLink, Role.RoleServiceIdentity -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableRole.Builderbuilder()Creates a builder forImmutableRole.static ImmutableRoleCreates an immutable copy of aRolevalue.booleanThis instance is equal to all instances ofImmutableRolethat have equal attribute values.inthashCode()Computes a hash code from attributes:name,id,description,policies,serviceIdentities,nodeIdentities,namespace.id()name()com.google.common.collect.ImmutableList<Role.RoleNodeIdentity>com.google.common.collect.ImmutableList<Role.RolePolicyLink>policies()com.google.common.collect.ImmutableList<Role.RoleServiceIdentity>toString()Prints the immutable valueRolewith attribute values.final ImmutableRolewithDescription(String value) Copy the current immutable object by setting a present value for the optionaldescriptionattribute.final ImmutableRolewithDescription(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescriptionattribute.final ImmutableRoleCopy the current immutable object by setting a present value for the optionalidattribute.final ImmutableRoleCopy the current immutable object by setting an optional value for theidattribute.final ImmutableRoleCopy the current immutable object by setting a value for thenameattribute.final ImmutableRolewithNamespace(String value) Copy the current immutable object by setting a present value for the optionalnamespaceattribute.final ImmutableRolewithNamespace(Optional<String> optional) Copy the current immutable object by setting an optional value for thenamespaceattribute.final ImmutableRolewithNodeIdentities(Iterable<? extends Role.RoleNodeIdentity> elements) Copy the current immutable object with elements that replace the content ofnodeIdentities.final ImmutableRolewithNodeIdentities(Role.RoleNodeIdentity... elements) Copy the current immutable object with elements that replace the content ofnodeIdentities.final ImmutableRolewithPolicies(Iterable<? extends Role.RolePolicyLink> elements) Copy the current immutable object with elements that replace the content ofpolicies.final ImmutableRolewithPolicies(Role.RolePolicyLink... elements) Copy the current immutable object with elements that replace the content ofpolicies.final ImmutableRolewithServiceIdentities(Iterable<? extends Role.RoleServiceIdentity> elements) Copy the current immutable object with elements that replace the content ofserviceIdentities.final ImmutableRolewithServiceIdentities(Role.RoleServiceIdentity... elements) Copy the current immutable object with elements that replace the content ofserviceIdentities.
-
Method Details
-
name
-
id
-
description
- Specified by:
descriptionin classRole- Returns:
- The value of the
descriptionattribute
-
policies
-
serviceIdentities
- Specified by:
serviceIdentitiesin classRole- Returns:
- The value of the
serviceIdentitiesattribute
-
nodeIdentities
- Specified by:
nodeIdentitiesin classRole- Returns:
- The value of the
nodeIdentitiesattribute
-
namespace
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withId
Copy the current immutable object by setting a present value for the optionalidattribute.- Parameters:
value- The value for id- Returns:
- A modified copy of
thisobject
-
withId
Copy the current immutable object by setting an optional value for theidattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for id- Returns:
- A modified copy of
thisobject
-
withDescription
Copy the current immutable object by setting a present value for the optionaldescriptionattribute.- Parameters:
value- The value for description- Returns:
- A modified copy of
thisobject
-
withDescription
Copy the current immutable object by setting an optional value for thedescriptionattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for description- Returns:
- A modified copy of
thisobject
-
withPolicies
Copy the current immutable object with elements that replace the content ofpolicies.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withPolicies
Copy the current immutable object with elements that replace the content ofpolicies. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of policies elements to set- Returns:
- A modified copy of
thisobject
-
withServiceIdentities
Copy the current immutable object with elements that replace the content ofserviceIdentities.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withServiceIdentities
public final ImmutableRole withServiceIdentities(Iterable<? extends Role.RoleServiceIdentity> elements) Copy the current immutable object with elements that replace the content ofserviceIdentities. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of serviceIdentities elements to set- Returns:
- A modified copy of
thisobject
-
withNodeIdentities
Copy the current immutable object with elements that replace the content ofnodeIdentities.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withNodeIdentities
Copy the current immutable object with elements that replace the content ofnodeIdentities. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of nodeIdentities elements to set- Returns:
- A modified copy of
thisobject
-
withNamespace
Copy the current immutable object by setting a present value for the optionalnamespaceattribute.- Parameters:
value- The value for namespace- Returns:
- A modified copy of
thisobject
-
withNamespace
Copy the current immutable object by setting an optional value for thenamespaceattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for namespace- Returns:
- A modified copy of
thisobject
-
equals
This instance is equal to all instances ofImmutableRolethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:name,id,description,policies,serviceIdentities,nodeIdentities,namespace. -
toString
Prints the immutable valueRolewith attribute values. -
copyOf
Creates an immutable copy of aRolevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Role instance
-
builder
Creates a builder forImmutableRole.ImmutableRole.builder() .name(String) // requiredname.id(String) // optionalid.description(String) // optionaldescription.addPolicies|addAllPolicies(org.kiwiproject.consul.model.acl.Role.RolePolicyLink) //policieselements .addServiceIdentities|addAllServiceIdentities(org.kiwiproject.consul.model.acl.Role.RoleServiceIdentity) //serviceIdentitieselements .addNodeIdentities|addAllNodeIdentities(org.kiwiproject.consul.model.acl.Role.RoleNodeIdentity) //nodeIdentitieselements .namespace(String) // optionalnamespace.build();- Returns:
- A new ImmutableRole builder
-