Class ImmutableDownstreamMessage.Builder

  • Enclosing class:
    ImmutableDownstreamMessage

    @NotThreadSafe
    public static final class ImmutableDownstreamMessage.Builder
    extends Object
    Builds instances of type ImmutableDownstreamMessage. 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 ImmutableDownstreamMessage instances.
         new ImmutableDownstreamMessage.Builder()
            .port(int) // required port
            .payload(byte) // required payload
            .build();
         
    • Method Detail

      • from

        public final ImmutableDownstreamMessage.Builder from​(DownstreamMessage instance)
        Fill a builder with attribute values from the provided DownstreamMessage instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • port

        public final ImmutableDownstreamMessage.Builder port​(int port)
        Initializes the value for the port attribute.
        Parameters:
        port - The value for port
        Returns:
        this builder for use in a chained invocation
      • payload

        public final ImmutableDownstreamMessage.Builder payload​(byte... payload)
        Initializes the value for the payload attribute.
        Parameters:
        payload - The elements for payload
        Returns:
        this builder for use in a chained invocation