org.gcube.common.clients.config
Class AbstractConfig<A,S>

java.lang.Object
  extended by org.gcube.common.clients.config.AbstractConfig<A,S>
Type Parameters:
A - the type of service addresses
S - 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 of ProxyConfig.

Author:
Fabio Simeoni

Constructor Summary
protected AbstractConfig(ProxyPlugin<A,S,?> plugin)
          Creates an instance with a given ProxyPlugin.
 
Method Summary
 void addProperty(Property<?> property)
          Adds a custom property to the configuration.
<T> void
addProperty(String name, T value)
          Adds a custom property to the configuration.
 boolean hasProperty(String property)
          Returns true if the configuration includes a given custom property.
 ProxyPlugin<A,S,?> plugin()
          Returns the ProxyPlugin.
<T> T
property(String property, Class<T> clazz)
          Returns the value of a given custom property.
 long timeout()
          Returns the timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConfig

protected AbstractConfig(ProxyPlugin<A,S,?> plugin)
Creates an instance with a given ProxyPlugin.

Parameters:
plugin - the plugin
Method Detail

plugin

public ProxyPlugin<A,S,?> plugin()
Description copied from interface: ProxyConfig
Returns the ProxyPlugin.

Specified by:
plugin in interface ProxyConfig<A,S>
Returns:
the plugin

timeout

public long timeout()
             throws IllegalArgumentException
Description copied from interface: ProxyConfig
Returns the timeout.

Specified by:
timeout in interface ProxyConfig<A,S>
Returns:
the timeout
Throws:
IllegalArgumentException

addProperty

public <T> void addProperty(String name,
                            T value)
Description copied from interface: ProxyConfig
Adds a custom property to the configuration.

Specified by:
addProperty in interface ProxyConfig<A,S>
Type Parameters:
T - the type of the property value
Parameters:
name - the name of the property
value - the value of the property

addProperty

public void addProperty(Property<?> property)
Description copied from interface: ProxyConfig
Adds a custom property to the configuration.

Specified by:
addProperty in interface ProxyConfig<A,S>
Parameters:
property - the property

hasProperty

public boolean hasProperty(String property)
Description copied from interface: ProxyConfig
Returns true if the configuration includes a given custom property.

Specified by:
hasProperty in interface ProxyConfig<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: ProxyConfig
Returns the value of a given custom property.

Specified by:
property in interface ProxyConfig<A,S>
Parameters:
property - the name of the property
clazz - the type of the property value
Returns:
the property value
Throws:
IllegalStateException - if the property is not included in the configuration
IllegalArgumentException - if the property exists but its value has a different value * @param the type of the property value


Copyright © 2012. All Rights Reserved.