public interface APIResponses extends Constructible, Extensible<APIResponses>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT |
Modifier and Type | Method and Description |
---|---|
APIResponses |
addAPIResponse(java.lang.String name,
APIResponse apiResponse)
Adds an APIResponse in the format of the name as a key and the item as the value to APIResponses map
|
default APIResponses |
defaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses and return this instance of ApiResponses.
|
default APIResponse |
getAPIResponse(java.lang.String name)
Returns a APIResponse for a given name.
|
java.util.Map<java.lang.String,APIResponse> |
getAPIResponses()
Returns a copy map (potentially immutable) of the APIResponses.
|
APIResponse |
getDefaultValue()
Returns the default documentation of responses other than the ones declared for specific HTTP response codes in this instance of ApiResponses.
|
default boolean |
hasAPIResponse(java.lang.String name)
Check whether a APIResponse is present in the map.
|
void |
removeAPIResponse(java.lang.String name)
Removes the given APIResponse to this APIResponses.
|
void |
setAPIResponses(java.util.Map<java.lang.String,APIResponse> items)
Set the APIResponses map to this APIResponses
|
void |
setDefaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses.
|
addExtension, extensions, getExtensions, removeExtension, setExtensions
static final java.lang.String DEFAULT
APIResponses addAPIResponse(java.lang.String name, APIResponse apiResponse)
name
- the name of APIResponse (http status code eventually with wildcard or "default")apiResponse
- the APIResponse object to be added to APIResponses map. null values will be rejected (implementation will throw an
exception) or ignored.void removeAPIResponse(java.lang.String name)
name
- the name of APIResponse that will be removed (http status code eventually with wildcard or "default")java.util.Map<java.lang.String,APIResponse> getAPIResponses()
void setAPIResponses(java.util.Map<java.lang.String,APIResponse> items)
items
- a map containing all responses. Keys are http statuses code eventually with wildcard or "default".default boolean hasAPIResponse(java.lang.String name)
getAPIResponses().containsKey(name)
name
- the name of APIResponse (http status code eventually with wildcard or "default")default APIResponse getAPIResponse(java.lang.String name)
getAPIResponses().get(name)
name
- the name of APIResponse (http status code eventually with wildcard or "default")APIResponse getDefaultValue()
Convenience method that is the same as calling getAPIResponse(String)
on the map with "default" as value for the key.
void setDefaultValue(APIResponse defaultValue)
Convenience method that is the same as calling addAPIResponse(String, APIResponse)
with "default" as value for the key.
defaultValue
- the default documentation of responsesdefault APIResponses defaultValue(APIResponse defaultValue)
Convenience method that is the same as calling addAPIResponse(String, APIResponse)
with "default" as value for the key.
defaultValue
- the default documentation of responses