Interface Content

  • All Superinterfaces:
    Constructible, java.util.Map<java.lang.String,​MediaType>

    public interface Content
    extends Constructible, java.util.Map<java.lang.String,​MediaType>
    Content

    A map to assist describing the media types for an operation's parameter or response.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      Content addMediaType​(java.lang.String name, MediaType mediaType)
      Adds the MediaType for this Content, where the key is the name of the MediaType and the value is the object that describes the content passed into or returned from an operation.
      boolean containsKey​(java.lang.Object key)
      Deprecated.
      since 1.1
      MediaType get​(java.lang.Object key)
      Deprecated.
      since 1.1
      default MediaType getMediaType​(java.lang.String name)
      Returns a media type for a given name.
      java.util.Map<java.lang.String,​MediaType> getMediaTypes()
      Returns a copy map (potentially immutable) of media types.
      default boolean hasMediaType​(java.lang.String name)
      Check whether a media type is present in the map.
      MediaType put​(java.lang.String key, MediaType value)
      Deprecated.
      since 1.1
      void putAll​(java.util.Map<? extends java.lang.String,​? extends MediaType> m)
      Deprecated.
      since 1.1
      MediaType remove​(java.lang.Object key)
      Deprecated.
      since 1.1
      void removeMediaType​(java.lang.String name)
      Removes the given MediaType for this Content by its name.
      void setMediaTypes​(java.util.Map<java.lang.String,​MediaType> mediaTypes)
      Set the media types map to this Content
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
    • Method Detail

      • addMediaType

        Content addMediaType​(java.lang.String name,
                             MediaType mediaType)
        Adds the MediaType for this Content, where the key is the name of the MediaType and the value is the object that describes the content passed into or returned from an operation.
        Parameters:
        name - the name of a media type e.g. application/json.
        mediaType - an object that describes the content passed into or returned from an operation. null values will be rejected (implementation will throw an exception) or ignored.
        Returns:
        the current Content instance
      • removeMediaType

        void removeMediaType​(java.lang.String name)
        Removes the given MediaType for this Content by its name.
        Parameters:
        name - a path name that will be removed.
      • getMediaTypes

        java.util.Map<java.lang.String,​MediaType> getMediaTypes()
        Returns a copy map (potentially immutable) of media types.
        Returns:
        all items
      • setMediaTypes

        void setMediaTypes​(java.util.Map<java.lang.String,​MediaType> mediaTypes)
        Set the media types map to this Content
        Parameters:
        mediaTypes - a map containing the list of media types. Keys are name of a media type e.g. application/json.
      • hasMediaType

        default boolean hasMediaType​(java.lang.String name)
        Check whether a media type is present in the map. This is a convenience method for getMediaTypes().containsKey(name)
        Parameters:
        name - the name of a media type e.g. application/json.
        Returns:
        a boolean to indicate if the media type is present or not.
      • getMediaType

        default MediaType getMediaType​(java.lang.String name)
        Returns a media type for a given name. This is a convenience method for getMediaTypes().get(name)
        Parameters:
        name - the name of a media type e.g. application/json.
        Returns:
        the corresponding media type or null.
      • get

        @Deprecated
        MediaType get​(java.lang.Object key)
        Deprecated.
        since 1.1
        In the next version, Content will no longer extends Map, this method will no longer be present. Use getMediaType(String) instead.
        Specified by:
        get in interface java.util.Map<java.lang.String,​MediaType>
      • containsKey

        @Deprecated
        boolean containsKey​(java.lang.Object key)
        Deprecated.
        since 1.1
        In the next version, Content will no longer extends Map, this method will no longer be present. Use hasMediaType(String) instead.
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​MediaType>
      • putAll

        @Deprecated
        void putAll​(java.util.Map<? extends java.lang.String,​? extends MediaType> m)
        Deprecated.
        since 1.1
        In the next version, Content will no longer extends Map, this method will no longer be present. Use setMediaTypes(Map) instead.
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​MediaType>
      • remove

        @Deprecated
        MediaType remove​(java.lang.Object key)
        Deprecated.
        since 1.1
        In the next version, Content will no longer extends Map, this method will no longer be present. Use removeMediaType(String) instead.
        Specified by:
        remove in interface java.util.Map<java.lang.String,​MediaType>