Class ImmutableResponse.Builder

java.lang.Object
io.dialob.api.rest.ImmutableResponse.Builder
Enclosing class:
ImmutableResponse

@NotThreadSafe public static final class ImmutableResponse.Builder extends Object
Builds instances of type ImmutableResponse. 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.

  • Method Details

    • from

      public final ImmutableResponse.Builder from(Response instance)
      Fill a builder with attribute values from the provided io.dialob.api.rest.Response instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      public final ImmutableResponse.Builder from(ResponseStatus instance)
      Fill a builder with attribute values from the provided io.dialob.api.rest.ResponseStatus instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • ok

      public final ImmutableResponse.Builder ok(Boolean ok)
      Initializes the value for the ok attribute.
      Parameters:
      ok - The value for ok (can be null)
      Returns:
      this builder for use in a chained invocation
    • error

      public final ImmutableResponse.Builder error(String error)
      Initializes the value for the error attribute.
      Parameters:
      error - The value for error (can be null)
      Returns:
      this builder for use in a chained invocation
    • reason

      public final ImmutableResponse.Builder reason(String reason)
      Initializes the value for the reason attribute.
      Parameters:
      reason - The value for reason (can be null)
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableResponse build()
      Builds a new ImmutableResponse.
      Returns:
      An immutable instance of Response
      Throws:
      IllegalStateException - if any required attributes are missing