Interface Discriminator
- All Superinterfaces:
Constructible
Discriminator
When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.
-
Method Summary
Modifier and TypeMethodDescriptionaddMapping
(String name, String value) Maps the given name to the given value and stores it in this Discriminator's mapping property.Returns the mapping property from a Discriminator instance.Returns the propertyName property from a Discriminator instance.default Discriminator
Sets this Discriminator's mapping property to the given map object.default Discriminator
propertyName
(String propertyName) Sets this Discriminator's propertyName property to the given string.void
removeMapping
(String name) Remove the given name to the given value and stores it in this Discriminator's mapping property.void
setMapping
(Map<String, String> mapping) Sets this Discriminator's mapping property to the given map object.void
setPropertyName
(String propertyName) Sets this Discriminator's propertyName property to the given propertyName.
-
Method Details
-
propertyName
Sets this Discriminator's propertyName property to the given string.- Parameters:
propertyName
- the name of the property in the payload that will hold the discriminator value- Returns:
- the current Discriminator instance
-
getPropertyName
String getPropertyName()Returns the propertyName property from a Discriminator instance.- Returns:
- the name of the property in the payload that will hold the discriminator value
-
setPropertyName
Sets this Discriminator's propertyName property to the given propertyName.- Parameters:
propertyName
- the name of the property in the payload that will hold the discriminator value
-
addMapping
Maps the given name to the given value and stores it in this Discriminator's mapping property.- Parameters:
name
- a key which will be compared to information from a request body or response payload.value
- a schema name or reference. null values will be rejected (implementation will throw an exception) or ignored.- Returns:
- the current Discriminator instance
-
removeMapping
Remove the given name to the given value and stores it in this Discriminator's mapping property.- Parameters:
name
- a key which will be compared to information from a request body or response payload.
-
mapping
Sets this Discriminator's mapping property to the given map object.- Parameters:
mapping
- a map containing keys and schema names or references- Returns:
- the current Discriminator instance
-
getMapping
Returns the mapping property from a Discriminator instance.- Returns:
- a map containing keys and schema names or references
-
setMapping
Sets this Discriminator's mapping property to the given map object.- Parameters:
mapping
- a map containing keys and schema names or references
-