Package com.telenordigital.nbiot
Class ImmutableTeam
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableTeam
-
- All Implemented Interfaces:
Team
@ParametersAreNonnullByDefault @Immutable public final class ImmutableTeam extends Object implements Team
Immutable implementation ofTeam.Use the builder to create immutable instances:
new ImmutableTeam.Builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTeam.BuilderBuilds instances of typeImmutableTeam.-
Nested classes/interfaces inherited from interface com.telenordigital.nbiot.Team
Team.TeamList
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableTeamcopyOf(Team instance)Creates an immutable copy of aTeamvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableTeamthat have equal attribute values.inthashCode()Computes a hash code from attributes:id,members,tags.Stringid()The team's IDMember[]members()The team's membersMap<String,String>tags()Team tags.StringtoString()Prints the immutable valueTeamwith attribute values.ImmutableTeamwithId(String value)Copy the current immutable object by setting a value for theidattribute.ImmutableTeamwithMembers(Member... elements)Copy the current immutable object with elements that replace the content ofmembers.ImmutableTeamwithTags(Map<String,? extends String> entries)Copy the current immutable object by replacing thetagsmap with the specified map.
-
-
-
Method Detail
-
withId
public final ImmutableTeam withId(@Nullable String value)
Copy the current immutable object by setting a value for theidattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for id (can benull)- Returns:
- A modified copy of the
thisobject
-
withMembers
public final ImmutableTeam withMembers(@Nullable Member... elements)
Copy the current immutable object with elements that replace the content ofmembers. The array is cloned before being saved as attribute values.- Parameters:
elements- The non-null elements for members- Returns:
- A modified copy of
thisobject
-
withTags
public final ImmutableTeam withTags(@Nullable Map<String,? extends String> entries)
Copy the current immutable object by replacing thetagsmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the tags map- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableTeamthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,members,tags.
-
toString
public String toString()
Prints the immutable valueTeamwith attribute values.
-
copyOf
public static ImmutableTeam copyOf(Team instance)
Creates an immutable copy of aTeamvalue. 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 Team instance
-
-