Class ImmutableContent

java.lang.Object
dk.mada.jaxrs.model.api.ImmutableContent
All Implemented Interfaces:
Content

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

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

  • Method Details

    • mediaTypes

      public Set<String> mediaTypes()
      Returns the content media types supported.
      Specified by:
      mediaTypes in interface Content
      Returns:
      the content media types supported
    • reference

      public Reference reference()
      Returns the content type.
      Specified by:
      reference in interface Content
      Returns:
      the content type
    • withMediaTypes

      public final ImmutableContent withMediaTypes(String... elements)
      Copy the current immutable object with elements that replace the content of mediaTypes.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withMediaTypes

      public final ImmutableContent withMediaTypes(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of mediaTypes. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of mediaTypes elements to set
      Returns:
      A modified copy or this if not changed
    • withReference

      public final ImmutableContent 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
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableContent 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: mediaTypes, reference.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableContent copyOf(Content instance)
      Creates an immutable copy of a Content 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 Content instance
    • builder

      public static ImmutableContent.Builder builder()
      Creates a builder for ImmutableContent.
       ImmutableContent.builder()
          .addMediaTypes|addAllMediaTypes(String) // mediaTypes elements
          .reference(dk.mada.jaxrs.model.types.Reference) // required reference
          .build();
       
      Returns:
      A new ImmutableContent builder