Package com.opencloud.slee.rest.common
Class ApiConfiguration
- java.lang.Object
-
- com.opencloud.slee.rest.common.ApiConfiguration
-
public final class ApiConfiguration extends java.lang.Object
The configuration to be used with a generated REST API.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ApiConfiguration
baseConfiguration()
Create an ApiConfiguration suitable for custom/hand-written APIs.<T> T
get(ApiOption<T> option)
Get the value of an option<T> boolean
isSet(ApiOption<T> option)
Check if an option has an associated value<T> void
set(ApiOption<T> option, T newValue)
Set the value of an optionstatic ApiConfiguration
standardConfiguration()
Create an ApiConfiguration suitable for generated APIs.java.lang.String
toString()
VerifyResult
verify()
Verify that all options, that have been set, have valid values.ApiConfiguration
withOption(ApiOption<?> option)
Add a new option to the configuration (for custom API implementations).
-
-
-
Method Detail
-
standardConfiguration
public static ApiConfiguration standardConfiguration()
Create an ApiConfiguration suitable for generated APIs.- Returns:
- an ApiConfiguration with additional properties to the base configuration
-
baseConfiguration
public static ApiConfiguration baseConfiguration()
Create an ApiConfiguration suitable for custom/hand-written APIs. Populates the configuration with the minimum set of required options- Returns:
- an ApiConfiguration with standard properties
-
withOption
public ApiConfiguration withOption(ApiOption<?> option)
Add a new option to the configuration (for custom API implementations).- Parameters:
option
- the option to add- Returns:
- the ApiConfiguration with the addition of a new option
-
verify
public VerifyResult verify()
Verify that all options, that have been set, have valid values.- Returns:
- A VerifyResult that represents the outcome of verifying all options that have been set.
-
get
public <T> T get(ApiOption<T> option)
Get the value of an option- Type Parameters:
T
- the type of the option- Parameters:
option
- the option to fetch- Returns:
- the associated option value
-
set
public <T> void set(ApiOption<T> option, T newValue)
Set the value of an option- Type Parameters:
T
- the type of the option- Parameters:
option
- the option to setnewValue
- the new option value
-
isSet
public <T> boolean isSet(ApiOption<T> option)
Check if an option has an associated value- Type Parameters:
T
- the type of the option- Parameters:
option
- the option to check- Returns:
- true iff there is a value associated with an option
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-