Class ImmutableDevice.Builder

  • Enclosing class:
    ImmutableDevice

    @NotThreadSafe
    public static final class ImmutableDevice.Builder
    extends Object
    Builds instances of type ImmutableDevice. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Constructor Detail

      • Builder

        public Builder()
        Creates a builder for ImmutableDevice instances.
    • Method Detail

      • from

        public final ImmutableDevice.Builder from​(Device instance)
        Fill a builder with attribute values from the provided Device instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • id

        public final ImmutableDevice.Builder id​(@Nullable
                                                String id)
        Initializes the value for the id attribute.
        Parameters:
        id - The value for id (can be null)
        Returns:
        this builder for use in a chained invocation
      • collectionID

        public final ImmutableDevice.Builder collectionID​(@Nullable
                                                          String collectionID)
        Initializes the value for the collectionID attribute.
        Parameters:
        collectionID - The value for collectionID (can be null)
        Returns:
        this builder for use in a chained invocation
      • imei

        public final ImmutableDevice.Builder imei​(@Nullable
                                                  String imei)
        Initializes the value for the imei attribute.
        Parameters:
        imei - The value for imei (can be null)
        Returns:
        this builder for use in a chained invocation
      • imsi

        public final ImmutableDevice.Builder imsi​(@Nullable
                                                  String imsi)
        Initializes the value for the imsi attribute.
        Parameters:
        imsi - The value for imsi (can be null)
        Returns:
        this builder for use in a chained invocation
      • putTags

        public final ImmutableDevice.Builder putTags​(String key,
                                                     String value)
        Put one entry to the tags map.
        Parameters:
        key - The key in the tags map
        value - The associated value in the tags map
        Returns:
        this builder for use in a chained invocation
      • putTags

        public final ImmutableDevice.Builder putTags​(Map.Entry<String,​? extends String> entry)
        Put one entry to the tags map. Nulls are not permitted
        Parameters:
        entry - The key and value entry
        Returns:
        this builder for use in a chained invocation
      • tags

        public final ImmutableDevice.Builder tags​(@Nullable
                                                  Map<String,​? extends String> tags)
        Sets or replaces all mappings from the specified map as entries for the tags map. Nulls are not permitted as keys or values, but parameter itself can be null
        Parameters:
        tags - The entries that will be added to the tags map
        Returns:
        this builder for use in a chained invocation
      • putAllTags

        public final ImmutableDevice.Builder putAllTags​(Map<String,​? extends String> tags)
        Put all mappings from the specified map as entries to tags map. Nulls are not permitted
        Parameters:
        tags - The entries that will be added to the tags map
        Returns:
        this builder for use in a chained invocation