public interface MediaType extends Constructible, Extensible<MediaType>
Each Media Type Object provides a schema and examples for the media type identified by its key.
Modifier and Type | Method and Description |
---|---|
MediaType |
addEncoding(java.lang.String key,
Encoding encodingItem)
Adds an Encoding item to the encoding property of a MediaType instance.
|
MediaType |
addExample(java.lang.String key,
Example example)
Adds an example item to the examples map of a MediaType instance.
|
default MediaType |
encoding(java.util.Map<java.lang.String,Encoding> encoding)
Sets encoding property of a MediaType instance to the given map object.
|
default MediaType |
example(java.lang.Object example)
Sets the example property of a MediaType instance to the given value.
|
default MediaType |
examples(java.util.Map<java.lang.String,Example> examples)
Sets the examples field of a MediaType instance to the given map object.
|
java.util.Map<java.lang.String,Encoding> |
getEncoding()
Returns the encoding property from a MediaType instance.
|
java.lang.Object |
getExample()
Returns the example property from a MediaType instance.
|
java.util.Map<java.lang.String,Example> |
getExamples()
Returns the collection of examples from a MediaType instance.
|
Schema |
getSchema()
Returns the schema property from a MediaType instance.
|
void |
removeEncoding(java.lang.String key)
Removes an Encoding item to the encoding property of a MediaType instance.
|
void |
removeExample(java.lang.String key)
Removes an example item to the examples map of a MediaType instance.
|
default MediaType |
schema(Schema schema)
Sets the schema field of a MediaType instance to the given schema object.
|
void |
setEncoding(java.util.Map<java.lang.String,Encoding> encoding)
Sets encoding property of a MediaType instance to the given map object.
|
void |
setExample(java.lang.Object example)
Sets the example property of a MediaType instance to the given value.
|
void |
setExamples(java.util.Map<java.lang.String,Example> examples)
Sets the examples field of a MediaType instance to the given map object.
|
void |
setSchema(Schema schema)
Sets the schema field of a MediaType instance to the given schema object.
|
addExtension, extensions, getExtensions, removeExtension, setExtensions
Schema getSchema()
void setSchema(Schema schema)
schema
- the schema defining the type used for the request bodydefault MediaType schema(Schema schema)
schema
- the schema defining the type used for the request bodyjava.util.Map<java.lang.String,Example> getExamples()
void setExamples(java.util.Map<java.lang.String,Example> examples)
examples
- examples of the media typedefault MediaType examples(java.util.Map<java.lang.String,Example> examples)
examples
- examples of the media typeMediaType addExample(java.lang.String key, Example example)
key
- any unique name to identify the example objectexample
- an example of a media type. null values will be rejected (implementation will throw an exception) or
ignored.void removeExample(java.lang.String key)
key
- any unique name to identify the example objectjava.lang.Object getExample()
void setExample(java.lang.Object example)
example
- an example of the media typedefault MediaType example(java.lang.Object example)
example
- an example of the media typejava.util.Map<java.lang.String,Encoding> getEncoding()
void setEncoding(java.util.Map<java.lang.String,Encoding> encoding)
encoding
- a map between property names and their encoding informationdefault MediaType encoding(java.util.Map<java.lang.String,Encoding> encoding)
encoding
- a map between property names and their encoding informationMediaType addEncoding(java.lang.String key, Encoding encodingItem)
key
- a property name in the schemaencodingItem
- an encoding definition to apply to the schema property. null values will be rejected (implementation
will throw an exception) or ignored.void removeEncoding(java.lang.String key)
key
- a property name in the schema