Package co.arago.hiro.client.connection
Class AbstractAPIHandler.Conf<T extends AbstractAPIHandler.Conf<T>>
- java.lang.Object
-
- co.arago.hiro.client.connection.AbstractAPIHandler.Conf<T>
-
- Type Parameters:
T- The type of the Builder
- All Implemented Interfaces:
AbstractAPIHandler.GetterConf
- Direct Known Subclasses:
AbstractClientAPIHandler.Conf
- Enclosing class:
- AbstractAPIHandler
public abstract static class AbstractAPIHandler.Conf<T extends AbstractAPIHandler.Conf<T>> extends java.lang.Object implements AbstractAPIHandler.GetterConf
The basic configuration for all APIHAndler
-
-
Constructor Summary
Constructors Constructor Description Conf()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AbstractAPIHandlerbuild()java.net.URLgetApiUrl()java.lang.LonggetHttpRequestTimeout()intgetMaxRetries()java.lang.StringgetUserAgent()java.net.URIgetWebSocketUri()protected abstract Tself()TsetApiUrl(java.lang.String apiUrl)TsetApiUrl(java.net.URL apiUrl)TsetHttpRequestTimeout(java.lang.Long httpRequestTimeout)TsetMaxRetries(int maxRetries)TsetUserAgent(java.lang.String userAgent)For header "User-Agent".TsetWebSocketUri(java.lang.String webSocketUri)TsetWebSocketUrl(java.net.URL apiUrl)
-
-
-
Method Detail
-
getApiUrl
public java.net.URL getApiUrl()
- Specified by:
getApiUrlin interfaceAbstractAPIHandler.GetterConf
-
getWebSocketUri
public java.net.URI getWebSocketUri()
- Specified by:
getWebSocketUriin interfaceAbstractAPIHandler.GetterConf
-
setApiUrl
public T setApiUrl(java.lang.String apiUrl) throws java.net.MalformedURLException
- Parameters:
apiUrl- The root url for the API- Returns:
self()- Throws:
java.net.MalformedURLException- When the apiUrl is a malformed URL.
-
setApiUrl
public T setApiUrl(java.net.URL apiUrl)
- Parameters:
apiUrl- The root url for the API- Returns:
self()
-
setWebSocketUri
public T setWebSocketUri(java.lang.String webSocketUri) throws java.net.URISyntaxException
- Parameters:
webSocketUri- The root uri for the WebSockets. If this is missing, the uri will be constructed from an apiUrl.- Returns:
self()- Throws:
java.net.URISyntaxException- When the webSocketUri is a malformed URI.
-
setWebSocketUrl
public T setWebSocketUrl(java.net.URL apiUrl)
- Parameters:
apiUrl- The root url for the WebSockets- Returns:
self()
-
getUserAgent
public java.lang.String getUserAgent()
- Specified by:
getUserAgentin interfaceAbstractAPIHandler.GetterConf
-
setUserAgent
public T setUserAgent(java.lang.String userAgent)
For header "User-Agent". Default is determined by the package.- Parameters:
userAgent- The line for the User-Agent header.- Returns:
self()
-
getHttpRequestTimeout
public java.lang.Long getHttpRequestTimeout()
- Specified by:
getHttpRequestTimeoutin interfaceAbstractAPIHandler.GetterConf
-
setHttpRequestTimeout
public T setHttpRequestTimeout(java.lang.Long httpRequestTimeout)
- Parameters:
httpRequestTimeout- Request timeout in ms.- Returns:
self()
-
getMaxRetries
public int getMaxRetries()
- Specified by:
getMaxRetriesin interfaceAbstractAPIHandler.GetterConf
-
setMaxRetries
public T setMaxRetries(int maxRetries)
- Parameters:
maxRetries- Max amount of retries when http errors are received. The default is 0.- Returns:
self()
-
self
protected abstract T self()
-
build
public abstract AbstractAPIHandler build()
-
-