Package org.gcube.common.clients.config
Class AbstractConfig<A,S>
- java.lang.Object
-
- org.gcube.common.clients.config.AbstractConfig<A,S>
-
- Type Parameters:
A- the type of service addressesS- the type of service stubs
- All Implemented Interfaces:
ProxyConfig<A,S>
- Direct Known Subclasses:
DiscoveryConfig,EndpointConfig
public abstract class AbstractConfig<A,S> extends Object implements ProxyConfig<A,S>
Partial implementation ofProxyConfig.- Author:
- Fabio Simeoni
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConfig(ProxyPlugin<A,S,?> plugin)Creates an instance with a givenProxyPlugin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaddProperty(String name, T value)Adds a custom property to the configuration.voidaddProperty(Property<?> property)Adds a custom property to the configuration.booleanhasProperty(String property)Returnstrueif the configuration includes a given custom property.ProxyPlugin<A,S,?>plugin()Returns theProxyPlugin.<T> Tproperty(String property, Class<T> clazz)Returns the value of a given custom property.longtimeout()Returns the timeout.
-
-
-
Constructor Detail
-
AbstractConfig
protected AbstractConfig(ProxyPlugin<A,S,?> plugin)
Creates an instance with a givenProxyPlugin.- Parameters:
plugin- the plugin
-
-
Method Detail
-
plugin
public ProxyPlugin<A,S,?> plugin()
Description copied from interface:ProxyConfigReturns theProxyPlugin.- Specified by:
pluginin interfaceProxyConfig<A,S>- Returns:
- the plugin
-
timeout
public long timeout() throws IllegalArgumentExceptionDescription copied from interface:ProxyConfigReturns the timeout.- Specified by:
timeoutin interfaceProxyConfig<A,S>- Returns:
- the timeout
- Throws:
IllegalArgumentException
-
addProperty
public <T> void addProperty(String name, T value)
Description copied from interface:ProxyConfigAdds a custom property to the configuration.- Specified by:
addPropertyin interfaceProxyConfig<A,S>- Type Parameters:
T- the type of the property value- Parameters:
name- the name of the propertyvalue- the value of the property
-
addProperty
public void addProperty(Property<?> property)
Description copied from interface:ProxyConfigAdds a custom property to the configuration.- Specified by:
addPropertyin interfaceProxyConfig<A,S>- Parameters:
property- the property
-
hasProperty
public boolean hasProperty(String property)
Description copied from interface:ProxyConfigReturnstrueif the configuration includes a given custom property.- Specified by:
hasPropertyin interfaceProxyConfig<A,S>- Parameters:
property- the name of the property- Returns:
-
property
public <T> T property(String property, Class<T> clazz) throws IllegalStateException, IllegalArgumentException
Description copied from interface:ProxyConfigReturns the value of a given custom property.- Specified by:
propertyin interfaceProxyConfig<A,S>- Parameters:
property- the name of the propertyclazz- the type of the property value- Returns:
- the property value
- Throws:
IllegalStateException- if the property is not included in the configurationIllegalArgumentException- if the property exists but its value has a different value * @paramthe type of the property value
-
-