Interface APIResponses
-
- All Superinterfaces:
Constructible
,Extensible<APIResponses>
,java.util.Map<java.lang.String,APIResponse>
public interface APIResponses extends Constructible, Extensible<APIResponses>, java.util.Map<java.lang.String,APIResponse>
This interface represents the container for the expected responses of an operation. The container maps a HTTP response code to the expected response.- See Also:
- Responses Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default APIResponses
addApiResponse(java.lang.String name, APIResponse apiResponse)
Deprecated.since 1.1, useaddAPIResponse(String, APIResponse)
insteadAPIResponses
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 mapboolean
containsKey(java.lang.Object key)
Deprecated.since 1.1default APIResponses
defaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses and return this instance of ApiResponses.APIResponse
get(java.lang.Object key)
Deprecated.since 1.1default 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.default APIResponse
getDefault()
Deprecated.since 1.1, use @linkgetDefaultValue()
insteadAPIResponse
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.APIResponse
put(java.lang.String key, APIResponse value)
Deprecated.since 1.1void
putAll(java.util.Map<? extends java.lang.String,? extends APIResponse> m)
Deprecated.since 1.1APIResponse
remove(java.lang.Object key)
Deprecated.since 1.1void
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 APIResponsesvoid
setDefaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses.-
Methods inherited from interface org.eclipse.microprofile.openapi.models.Extensible
addExtension, extensions, getExtensions, removeExtension, setExtensions
-
-
-
-
Field Detail
-
DEFAULT
static final java.lang.String DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
addApiResponse
@Deprecated default APIResponses addApiResponse(java.lang.String name, APIResponse apiResponse)
Deprecated.since 1.1, useaddAPIResponse(String, APIResponse)
insteadAdds an APIResponse in the format of the name as a key and the item as the value to APIResponses map- Parameters:
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.- Returns:
- APIResponses map with the added ApiResponse instance
-
addAPIResponse
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- Parameters:
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.- Returns:
- APIResponses map with the added ApiResponse instance
-
removeAPIResponse
void removeAPIResponse(java.lang.String name)
Removes the given APIResponse to this APIResponses.- Parameters:
name
- the name of APIResponse that will be removed (http status code eventually with wildcard or "default")
-
getAPIResponses
java.util.Map<java.lang.String,APIResponse> getAPIResponses()
Returns a copy map (potentially immutable) of the APIResponses.- Returns:
- all responses
-
setAPIResponses
void setAPIResponses(java.util.Map<java.lang.String,APIResponse> items)
Set the APIResponses map to this APIResponses- Parameters:
items
- a map containing all responses. Keys are http statuses code eventually with wildcard or "default".
-
hasAPIResponse
default boolean hasAPIResponse(java.lang.String name)
Check whether a APIResponse is present in the map. This is a convenience method forgetAPIResponses().containsKey(name)
- Parameters:
name
- the name of APIResponse (http status code eventually with wildcard or "default")- Returns:
- a boolean to indicate if the APIResponse is present or not.
-
getAPIResponse
default APIResponse getAPIResponse(java.lang.String name)
Returns a APIResponse for a given name. This is a convenience method forgetAPIResponses().get(name)
- Parameters:
name
- the name of APIResponse (http status code eventually with wildcard or "default")- Returns:
- the corresponding APIResponse or null.
-
get
@Deprecated APIResponse get(java.lang.Object key)
Deprecated.since 1.1In the next version,APIResponses
will no longer extendsMap
, this method will no longer be present. UsegetAPIResponse(String)
instead.- Specified by:
get
in interfacejava.util.Map<java.lang.String,APIResponse>
-
containsKey
@Deprecated boolean containsKey(java.lang.Object key)
Deprecated.since 1.1In the next version,APIResponses
will no longer extendsMap
, this method will no longer be present. UsehasAPIResponse(String)
instead.- Specified by:
containsKey
in interfacejava.util.Map<java.lang.String,APIResponse>
-
put
@Deprecated APIResponse put(java.lang.String key, APIResponse value)
Deprecated.since 1.1In the next version,APIResponses
will no longer extendsMap
, this method will no longer be present. UseaddAPIResponse(String, APIResponse)
instead.- Specified by:
put
in interfacejava.util.Map<java.lang.String,APIResponse>
-
putAll
@Deprecated void putAll(java.util.Map<? extends java.lang.String,? extends APIResponse> m)
Deprecated.since 1.1In the next version,APIResponses
will no longer extendsMap
, this method will no longer be present. UsesetAPIResponses(Map)
instead.- Specified by:
putAll
in interfacejava.util.Map<java.lang.String,APIResponse>
-
remove
@Deprecated APIResponse remove(java.lang.Object key)
Deprecated.since 1.1In the next version,APIResponses
will no longer extendsMap
, this method will no longer be present. UseremoveAPIResponse(String)
instead.- Specified by:
remove
in interfacejava.util.Map<java.lang.String,APIResponse>
-
getDefault
@Deprecated default APIResponse getDefault()
Deprecated.since 1.1, use @linkgetDefaultValue()
insteadReturns the default documentation of responses other than the ones declared for specific HTTP response codes in this instance of ApiResponses.Convenience method that is the same as calling
get(Object)
on the map with "default" as value for the key.- Returns:
- the default documentation of responses
-
getDefaultValue
APIResponse getDefaultValue()
Returns the default documentation of responses other than the ones declared for specific HTTP response codes in this instance of ApiResponses.Convenience method that is the same as calling
get(Object)
on the map with "default" as value for the key.- Returns:
- the default documentation of responses
-
setDefaultValue
void setDefaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses. This will cover all the undeclared responses.Convenience method that is the same as calling
addAPIResponse(String, APIResponse)
with "default" as value for the key.- Parameters:
defaultValue
- the default documentation of responses
-
defaultValue
default APIResponses defaultValue(APIResponse defaultValue)
Sets the default documentation of responses for this instance of ApiResponses and return this instance of ApiResponses. This will cover all the undeclared responses.Convenience method that is the same as calling
addAPIResponse(String, APIResponse)
with "default" as value for the key.- Parameters:
defaultValue
- the default documentation of responses- Returns:
- this ApiResponses instance
-
-