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.
| Modifier and Type | Method and Description |
|---|---|
| public Discriminator | Returns: the current Discriminator instancea key which will be compared to information from a request body or response payload. name, String a schema name or reference. null values will be rejected (implementation will throw an exception) or
ignored. value)Maps the given name to the given value and stores it in this Discriminator's mapping property. |
| public Map | Returns: a copy Map (potentially immutable) containing keys and schema names or referencesReturns the mapping property from a Discriminator instance. |
| public String | Returns: the name of the property in the payload that will hold the discriminator valueReturns the propertyName property from a Discriminator instance. |
| public default Discriminator | |
| public default Discriminator | Returns: the current Discriminator instancethe name of the property in the payload that will hold the discriminator value propertyName)Sets this Discriminator's propertyName property to the given string. |
| public void | removeMapping(String
a key which will be compared to information from a request body or response payload. name)Remove the given name to the given value and stores it in this Discriminator's mapping property. |
| public void | setMapping(Map<String, String>
a map containing keys and schema names or references mapping)Sets this Discriminator's mapping property to the given map object. |
| public void | setPropertyName(String
the name of the property in the payload that will hold the discriminator value propertyName)Sets this Discriminator's propertyName property to the given propertyName. |
| addMapping | back to summary |
|---|---|
| public Discriminator addMapping(String name, String value) Maps the given name to the given value and stores it in this Discriminator's mapping property.
| |
| getMapping | back to summary |
|---|---|
| public Map Returns the mapping property from a Discriminator instance. | |
| getPropertyName | back to summary |
|---|---|
| public String getPropertyName() Returns the propertyName property from a Discriminator instance.
| |
| mapping | back to summary |
|---|---|
| public default Discriminator mapping(Map<String, String> mapping) Sets this Discriminator's mapping property to the given map object.
| |
| propertyName | back to summary |
|---|---|
| public default Discriminator propertyName(String propertyName) Sets this Discriminator's propertyName property to the given string.
| |
| removeMapping | back to summary |
|---|---|
| public void removeMapping(String name) Remove the given name to the given value and stores it in this Discriminator's mapping property.
| |
| setMapping | back to summary |
|---|---|
| public void setMapping(Map<String, String> mapping) Sets this Discriminator's mapping property to the given map object. | |
| setPropertyName | back to summary |
|---|---|
| public void setPropertyName(String propertyName) Sets this Discriminator's propertyName property to the given propertyName.
| |