Class ImmutableParameter

java.lang.Object
dk.mada.jaxrs.model.api.ImmutableParameter
All Implemented Interfaces:
Parameter

@Generated(from="Parameter", generator="Immutables") @Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableParameter extends Object implements Parameter
Immutable implementation of Parameter.

Use the builder to create immutable instances: ImmutableParameter.builder().

  • Method Details

    • name

      public String name()
      Returns parameter name.
      Specified by:
      name in interface Parameter
      Returns:
      parameter name
    • reference

      public Reference reference()
      Returns parameter type.
      Specified by:
      reference in interface Parameter
      Returns:
      parameter type
    • description

      public Optional<String> description()
      Returns an optional description of the parameter.
      Specified by:
      description in interface Parameter
      Returns:
      an optional description of the parameter
    • isHeaderParam

      public boolean isHeaderParam()
      Returns true if the parameter is a header parameter, otherwise false.
      Specified by:
      isHeaderParam in interface Parameter
      Returns:
      true if the parameter is a header parameter, otherwise false
    • isPathParam

      public boolean isPathParam()
      Returns true if the parameter is a path parameter, otherwise false.
      Specified by:
      isPathParam in interface Parameter
      Returns:
      true if the parameter is a path parameter, otherwise false
    • isQueryParam

      public boolean isQueryParam()
      Returns true if the parameter is a query parameter, otherwise false.
      Specified by:
      isQueryParam in interface Parameter
      Returns:
      true if the parameter is a query parameter, otherwise false
    • isFormParam

      public boolean isFormParam()
      Returns true if the parameter is a form parameter, otherwise false.
      Specified by:
      isFormParam in interface Parameter
      Returns:
      true if the parameter is a form parameter, otherwise false
    • withName

      public final ImmutableParameter withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy or the this object
    • withReference

      public final ImmutableParameter withReference(Reference value)
      Copy the current immutable object by setting a value for the reference attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for reference
      Returns:
      A modified copy or the this object
    • withDescription

      public final ImmutableParameter withDescription(String value)
      Copy the current immutable object by setting a present value for the optional description attribute.
      Parameters:
      value - The value for description
      Returns:
      A modified copy or this if not changed
    • withDescription

      public final ImmutableParameter withDescription(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the description attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for description
      Returns:
      A modified copy or this if not changed
    • withIsHeaderParam

      public final ImmutableParameter withIsHeaderParam(boolean value)
      Copy the current immutable object by setting a value for the isHeaderParam attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isHeaderParam
      Returns:
      A modified copy or the this object
    • withIsPathParam

      public final ImmutableParameter withIsPathParam(boolean value)
      Copy the current immutable object by setting a value for the isPathParam attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isPathParam
      Returns:
      A modified copy or the this object
    • withIsQueryParam

      public final ImmutableParameter withIsQueryParam(boolean value)
      Copy the current immutable object by setting a value for the isQueryParam attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isQueryParam
      Returns:
      A modified copy or the this object
    • withIsFormParam

      public final ImmutableParameter withIsFormParam(boolean value)
      Copy the current immutable object by setting a value for the isFormParam attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isFormParam
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableParameter that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: name, reference, description, isHeaderParam, isPathParam, isQueryParam, isFormParam.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Parameter with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableParameter copyOf(Parameter instance)
      Creates an immutable copy of a Parameter value. 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 Parameter instance
    • builder

      public static ImmutableParameter.Builder builder()
      Creates a builder for ImmutableParameter.
       ImmutableParameter.builder()
          .name(String) // required name
          .reference(dk.mada.jaxrs.model.types.Reference) // required reference
          .description(Optional<String>) // optional description
          .isHeaderParam(boolean) // required isHeaderParam
          .isPathParam(boolean) // required isPathParam
          .isQueryParam(boolean) // required isQueryParam
          .isFormParam(boolean) // required isFormParam
          .build();
       
      Returns:
      A new ImmutableParameter builder