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
Partial implementation of
ProxyConfig.- Author:
- Fabio Simeoni
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractConfig(ProxyPlugin<A, S, ?> plugin) Creates an instance with a givenProxyPlugin. -
Method Summary
Modifier and TypeMethodDescription<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> TReturns the value of a given custom property.longtimeout()Returns the timeout.
-
Constructor Details
-
AbstractConfig
Creates an instance with a givenProxyPlugin.- Parameters:
plugin- the plugin
-
-
Method Details
-
plugin
Description copied from interface:ProxyConfigReturns theProxyPlugin.- Specified by:
pluginin interfaceProxyConfig<A,S> - Returns:
- the plugin
-
timeout
Description copied from interface:ProxyConfigReturns the timeout.- Specified by:
timeoutin interfaceProxyConfig<A,S> - Returns:
- the timeout
- Throws:
IllegalArgumentException
-
addProperty
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
Description copied from interface:ProxyConfigAdds a custom property to the configuration.- Specified by:
addPropertyin interfaceProxyConfig<A,S> - Parameters:
property- the property
-
hasProperty
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:
trueif the configuration has the property,falseotherwise
-
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> - Type Parameters:
T- the type of the property value- 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
-