Package com.telenordigital.nbiot
Class ImmutableDeviceList
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableDeviceList
-
- All Implemented Interfaces:
Device.DeviceList
@ParametersAreNonnullByDefault @Immutable public final class ImmutableDeviceList extends Object implements Device.DeviceList
Immutable implementation ofDevice.DeviceList.Use the builder to create immutable instances:
new ImmutableDeviceList.Builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableDeviceList.BuilderBuilds instances of typeImmutableDeviceList.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableDeviceListcopyOf(Device.DeviceList instance)Creates an immutable copy of aDevice.DeviceListvalue.Device[]devices()booleanequals(Object another)This instance is equal to all instances ofImmutableDeviceListthat have equal attribute values.inthashCode()Computes a hash code from attributes:devices.StringtoString()Prints the immutable valueDeviceListwith attribute values.ImmutableDeviceListwithDevices(Device... elements)Copy the current immutable object with elements that replace the content ofdevices.
-
-
-
Method Detail
-
devices
@Nullable public Device[] devices()
- Specified by:
devicesin interfaceDevice.DeviceList- Returns:
- A cloned
devicesarray
-
withDevices
public final ImmutableDeviceList withDevices(@Nullable Device... elements)
Copy the current immutable object with elements that replace the content ofdevices. The array is cloned before being saved as attribute values.- Parameters:
elements- The non-null elements for devices- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableDeviceListthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:devices.
-
toString
public String toString()
Prints the immutable valueDeviceListwith attribute values.
-
copyOf
public static ImmutableDeviceList copyOf(Device.DeviceList instance)
Creates an immutable copy of aDevice.DeviceListvalue. 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 DeviceList instance
-
-