Package com.telenordigital.nbiot
Class ImmutableDownstreamMessage
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableDownstreamMessage
-
- All Implemented Interfaces:
DownstreamMessage
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class ImmutableDownstreamMessage extends Object implements DownstreamMessage
Immutable implementation ofDownstreamMessage.Use the builder to create immutable instances:
new ImmutableDownstreamMessage.Builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableDownstreamMessage.BuilderBuilds instances of typeImmutableDownstreamMessage.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableDownstreamMessagecopyOf(DownstreamMessage instance)Creates an immutable copy of aDownstreamMessagevalue.booleanequals(Object another)This instance is equal to all instances ofImmutableDownstreamMessagethat have equal attribute values.inthashCode()Computes a hash code from attributes:port,payload.byte[]payload()The payload to send.intport()The port to send to.StringtoString()Prints the immutable valueDownstreamMessagewith attribute values.ImmutableDownstreamMessagewithPayload(byte... elements)Copy the current immutable object with elements that replace the content ofpayload.ImmutableDownstreamMessagewithPort(int value)Copy the current immutable object by setting a value for theportattribute.
-
-
-
Method Detail
-
port
public int port()
The port to send to.- Specified by:
portin interfaceDownstreamMessage
-
payload
public byte[] payload()
The payload to send.- Specified by:
payloadin interfaceDownstreamMessage
-
withPort
public final ImmutableDownstreamMessage withPort(int value)
Copy the current immutable object by setting a value for theportattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for port- Returns:
- A modified copy of the
thisobject
-
withPayload
public final ImmutableDownstreamMessage withPayload(byte... elements)
Copy the current immutable object with elements that replace the content ofpayload. The array is cloned before being saved as attribute values.- Parameters:
elements- The non-null elements for payload- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableDownstreamMessagethat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:port,payload.
-
toString
public String toString()
Prints the immutable valueDownstreamMessagewith attribute values.
-
copyOf
public static ImmutableDownstreamMessage copyOf(DownstreamMessage instance)
Creates an immutable copy of aDownstreamMessagevalue. 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 DownstreamMessage instance
-
-