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

public Interface MediaType

extends Constructible, Extensible<MediaType>
Imports
java.util.Map, org.eclipse.microprofile.openapi.models.Constructible, .Extensible, org.eclipse.microprofile.openapi.models.examples.Example

MediaType

Each Media Type Object provides a schema and examples for the media type identified by its key.

See Also
OpenAPI Specification Media Type Object

Method Summary

Modifier and TypeMethod and Description
public MediaType

Returns:

the current MediaType instance
addEncoding
(String
a property name in the schema
key
,
Encoding
an encoding definition to apply to the schema property. null values will be rejected (implementation will throw an exception) or ignored.
encodingItem
)

Adds an Encoding item to the encoding property of a MediaType instance.

public MediaType

Returns:

the current MediaType instance
addExample
(String
any unique name to identify the example object
key
,
Example
an example of a media type. null values will be rejected (implementation will throw an exception) or ignored.
example
)

Adds an example item to the examples map of a MediaType instance.

public default MediaType

Returns:

the current MediaType instance
encoding
(Map<String, Encoding>
a map between property names and their encoding information
encoding
)

Sets encoding property of a MediaType instance to the given map object.

public default MediaType

Returns:

the current MediaType instance
example
(Object
an example of the media type
example
)

Sets the example property of a MediaType instance to the given value.

public default MediaType

Returns:

the current MediaType instance
examples
(Map<String, Example>
examples of the media type
examples
)

Sets the examples field of a MediaType instance to the given map object.

public Map<String, Encoding>

Returns:

a copy Map (potentially immutable) between a property name and its encoding information
getEncoding
()

Returns the encoding property from a MediaType instance.

public Object

Returns:

an example of the media type
getExample
()

Returns the example property from a MediaType instance.

public Map<String, Example>

Returns:

a copy Map (potentially immutable) of examples of the media type
getExamples
()

Returns the collection of examples from a MediaType instance.

public Schema

Returns:

the schema defining the type used for the request body
getSchema
()

Returns the schema property from a MediaType instance.

public void
removeEncoding(String
a property name in the schema
key
)

Removes an Encoding item to the encoding property of a MediaType instance.

public void
removeExample(String
any unique name to identify the example object
key
)

Removes an example item to the examples map of a MediaType instance.

public default MediaType

Returns:

the current MediaType instance
schema
(Schema
the schema defining the type used for the request body
schema
)

Sets the schema field of a MediaType instance to the given schema object.

public void
setEncoding(Map<String, Encoding>
a map between property names and their encoding information
encoding
)

Sets encoding property of a MediaType instance to the given map object.

public void
setExample(Object
an example of the media type
example
)

Sets the example property of a MediaType instance to the given value.

public void
setExamples(Map<String, Example>
examples of the media type
examples
)

Sets the examples field of a MediaType instance to the given map object.

public void
setSchema(Schema
the schema defining the type used for the request body
schema
)

Sets the schema field of a MediaType instance to the given schema object.

Inherited from org.eclipse.microprofile.openapi.models.Extensible:
addExtensionextensionsgetExtensionsremoveExtensionsetExtensions

Method Detail

addEncodingback to summary
public MediaType addEncoding(String key, Encoding encodingItem)

Adds an Encoding item to the encoding property of a MediaType instance.

Parameters
key:String

a property name in the schema

encodingItem:Encoding

an encoding definition to apply to the schema property. null values will be rejected (implementation will throw an exception) or ignored.

Returns:MediaType

the current MediaType instance

addExampleback to summary
public MediaType addExample(String key, Example example)

Adds an example item to the examples map of a MediaType instance. The example object should match the media type and specified schema if present.

Parameters
key:String

any unique name to identify the example object

example:Example

an example of a media type. null values will be rejected (implementation will throw an exception) or ignored.

Returns:MediaType

the current MediaType instance

encodingback to summary
public default MediaType encoding(Map<String, Encoding> encoding)

Sets encoding property of a MediaType instance to the given map object.

Parameters
encoding:Map<String, Encoding>

a map between property names and their encoding information

Returns:MediaType

the current MediaType instance

exampleback to summary
public default MediaType example(Object example)

Sets the example property of a MediaType instance to the given value. The example object should be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object.

Parameters
example:Object

an example of the media type

Returns:MediaType

the current MediaType instance

examplesback to summary
public default MediaType examples(Map<String, Example> examples)

Sets the examples field of a MediaType instance to the given map object. Each example object should match the media type and specified schema if present. The example object is mutually exclusive of the examples object.

Parameters
examples:Map<String, Example>

examples of the media type

Returns:MediaType

the current MediaType instance

getEncodingback to summary
public Map<String, Encoding> getEncoding()

Returns the encoding property from a MediaType instance.

Returns:Map<String, Encoding>

a copy Map (potentially immutable) between a property name and its encoding information

getExampleback to summary
public Object getExample()

Returns the example property from a MediaType instance.

Returns:Object

an example of the media type

getExamplesback to summary
public Map<String, Example> getExamples()

Returns the collection of examples from a MediaType instance.

Returns:Map<String, Example>

a copy Map (potentially immutable) of examples of the media type

getSchemaback to summary
public Schema getSchema()

Returns the schema property from a MediaType instance.

Returns:Schema

the schema defining the type used for the request body

removeEncodingback to summary
public void removeEncoding(String key)

Removes an Encoding item to the encoding property of a MediaType instance.

Parameters
key:String

a property name in the schema

removeExampleback to summary
public void removeExample(String key)

Removes an example item to the examples map of a MediaType instance. The example object should match the media type and specified schema if present.

Parameters
key:String

any unique name to identify the example object

schemaback to summary
public default MediaType schema(Schema schema)

Sets the schema field of a MediaType instance to the given schema object.

Parameters
schema:Schema

the schema defining the type used for the request body

Returns:MediaType

the current MediaType instance

setEncodingback to summary
public void setEncoding(Map<String, Encoding> encoding)

Sets encoding property of a MediaType instance to the given map object.

Parameters
encoding:Map<String, Encoding>

a map between property names and their encoding information

setExampleback to summary
public void setExample(Object example)

Sets the example property of a MediaType instance to the given value. The example object should be in the correct format as specified by the media type. The example object is mutually exclusive of the examples object.

Parameters
example:Object

an example of the media type

setExamplesback to summary
public void setExamples(Map<String, Example> examples)

Sets the examples field of a MediaType instance to the given map object. Each example object should match the media type and specified schema if present. The example object is mutually exclusive of the examples object.

Parameters
examples:Map<String, Example>

examples of the media type

setSchemaback to summary
public void setSchema(Schema schema)

Sets the schema field of a MediaType instance to the given schema object.

Parameters
schema:Schema

the schema defining the type used for the request body