Top Description Methods
org.eclipse.microprofile.openapi.models.media

public Interface Content

extends Constructible
Imports
java.util.Map, org.eclipse.microprofile.openapi.models.Constructible

Content

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

Method Summary

Modifier and TypeMethod and Description
public Content

Returns:

the current Content instance
addMediaType
(String
the name of a media type e.g. application/json.
name
,
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.
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.

public default MediaType

Returns:

the corresponding media type or null.
getMediaType
(String
the name of a media type e.g. application/json.
name
)

Returns a media type for a given name.

public Map<String, MediaType>

Returns:

all items
getMediaTypes
()

Returns a copy map (potentially immutable) of media types.

public default boolean

Returns:

a boolean to indicate if the media type is present or not.
hasMediaType
(String
the name of a media type e.g. application/json.
name
)

Check whether a media type is present in the map.

public void
removeMediaType(String
a path name that will be removed.
name
)

Removes the given MediaType for this Content by its name.

public void
setMediaTypes(Map<String, MediaType>
a map containing the list of media types. Keys are name of a media type e.g. application/json.
mediaTypes
)

Set the media types map to this Content

Method Detail

addMediaTypeback to summary
public Content addMediaType(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:String

the name of a media type e.g. application/json.

mediaType: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:Content

the current Content instance

getMediaTypeback to summary
public default MediaType getMediaType(String name)

Returns a media type for a given name. This is a convenience method for getMediaTypes().get(name)

Parameters
name:String

the name of a media type e.g. application/json.

Returns:MediaType

the corresponding media type or null.

getMediaTypesback to summary
public Map<String, MediaType> getMediaTypes()

Returns a copy map (potentially immutable) of media types.

Returns:Map<String, MediaType>

all items

hasMediaTypeback to summary
public default boolean hasMediaType(String name)

Check whether a media type is present in the map. This is a convenience method for getMediaTypes().containsKey(name)

Parameters
name:String

the name of a media type e.g. application/json.

Returns:boolean

a boolean to indicate if the media type is present or not.

removeMediaTypeback to summary
public void removeMediaType(String name)

Removes the given MediaType for this Content by its name.

Parameters
name:String

a path name that will be removed.

setMediaTypesback to summary
public void setMediaTypes(Map<String, MediaType> mediaTypes)

Set the media types map to this Content

Parameters
mediaTypes:Map<String, MediaType>

a map containing the list of media types. Keys are name of a media type e.g. application/json.