Package com.orbitz.consul.model.acl
Class ImmutableToken
- java.lang.Object
-
- com.orbitz.consul.model.acl.Token
-
- com.orbitz.consul.model.acl.ImmutableToken
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableToken.BuilderBuilds instances of typeImmutableToken.-
Nested classes/interfaces inherited from class com.orbitz.consul.model.acl.Token
Token.PolicyLink
-
-
Method Summary
Modifier and Type Method Description static ImmutableToken.Builderbuilder()Creates a builder forImmutableToken.static ImmutableTokencopyOf(Token instance)Creates an immutable copy of aTokenvalue.java.util.Optional<java.lang.String>description()booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableTokenthat have equal attribute values.inthashCode()Computes a hash code from attributes:id,description,local,policies.java.util.Optional<java.lang.String>id()booleanlocal()com.google.common.collect.ImmutableList<Token.PolicyLink>policies()java.lang.StringtoString()Prints the immutable valueTokenwith attribute values.ImmutableTokenwithDescription(java.lang.String value)Copy the current immutable object by setting a present value for the optionaldescriptionattribute.ImmutableTokenwithDescription(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thedescriptionattribute.ImmutableTokenwithId(java.lang.String value)Copy the current immutable object by setting a present value for the optionalidattribute.ImmutableTokenwithId(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for theidattribute.ImmutableTokenwithLocal(boolean value)Copy the current immutable object by setting a value for thelocalattribute.ImmutableTokenwithPolicies(Token.PolicyLink... elements)Copy the current immutable object with elements that replace the content ofpolicies.ImmutableTokenwithPolicies(java.lang.Iterable<? extends Token.PolicyLink> elements)Copy the current immutable object with elements that replace the content ofpolicies.
-
-
-
Method Detail
-
id
public java.util.Optional<java.lang.String> id()
-
description
public java.util.Optional<java.lang.String> description()
- Specified by:
descriptionin classToken- Returns:
- The value of the
descriptionattribute
-
local
public boolean local()
-
policies
public com.google.common.collect.ImmutableList<Token.PolicyLink> policies()
-
withId
public final ImmutableToken withId(java.lang.String value)
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
public final ImmutableToken withId(java.util.Optional<java.lang.String> optional)
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
public final ImmutableToken withDescription(java.lang.String value)
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
public final ImmutableToken withDescription(java.util.Optional<java.lang.String> optional)
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
-
withLocal
public final ImmutableToken withLocal(boolean value)
Copy the current immutable object by setting a value for thelocalattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for local- Returns:
- A modified copy of the
thisobject
-
withPolicies
public final ImmutableToken withPolicies(Token.PolicyLink... elements)
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
public final ImmutableToken withPolicies(java.lang.Iterable<? extends Token.PolicyLink> elements)
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
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableTokenthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,description,local,policies.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueTokenwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableToken copyOf(Token instance)
Creates an immutable copy of aTokenvalue. 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 Token instance
-
builder
public static ImmutableToken.Builder builder()
Creates a builder forImmutableToken.ImmutableToken.builder() .id(String) // optionalid.description(String) // optionaldescription.local(boolean) // requiredlocal.addPolicies|addAllPolicies(com.orbitz.consul.model.acl.Token.PolicyLink) //policieselements .build();- Returns:
- A new ImmutableToken builder
-
-