Package com.telenordigital.nbiot
Class ImmutableOutput
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableOutput
-
- All Implemented Interfaces:
Output
@ParametersAreNonnullByDefault @Immutable public final class ImmutableOutput extends Object implements Output
Immutable implementation ofOutput.Use the builder to create immutable instances:
new ImmutableOutput.Builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableOutput.BuilderBuilds instances of typeImmutableOutput.-
Nested classes/interfaces inherited from interface com.telenordigital.nbiot.Output
Output.OutputList
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcollectionID()The collection the output belongs to.Map<String,Object>config()The type-specific configuration.static ImmutableOutputcopyOf(Output instance)Creates an immutable copy of aOutputvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableOutputthat have equal attribute values.inthashCode()Computes a hash code from attributes:id,collectionID,type,config.Stringid()The output's ID.StringtoString()Prints the immutable valueOutputwith attribute values.Stringtype()The output's type.ImmutableOutputwithCollectionID(String value)Copy the current immutable object by setting a value for thecollectionIDattribute.ImmutableOutputwithConfig(Map<String,? extends Object> entries)Copy the current immutable object by replacing theconfigmap with the specified map.ImmutableOutputwithId(String value)Copy the current immutable object by setting a value for theidattribute.ImmutableOutputwithType(String value)Copy the current immutable object by setting a value for thetypeattribute.
-
-
-
Method Detail
-
collectionID
@Nullable public String collectionID()
The collection the output belongs to.- Specified by:
collectionIDin interfaceOutput
-
withId
public final ImmutableOutput 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
-
withCollectionID
public final ImmutableOutput withCollectionID(@Nullable String value)
Copy the current immutable object by setting a value for thecollectionIDattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for collectionID (can benull)- Returns:
- A modified copy of the
thisobject
-
withType
public final ImmutableOutput withType(@Nullable String value)
Copy the current immutable object by setting a value for thetypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type (can benull)- Returns:
- A modified copy of the
thisobject
-
withConfig
public final ImmutableOutput withConfig(@Nullable Map<String,? extends Object> entries)
Copy the current immutable object by replacing theconfigmap 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 config map- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableOutputthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:id,collectionID,type,config.
-
toString
public String toString()
Prints the immutable valueOutputwith attribute values.
-
copyOf
public static ImmutableOutput copyOf(Output instance)
Creates an immutable copy of aOutputvalue. 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 Output instance
-
-