Class AbstractConfig<A,S>

java.lang.Object
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 Details

    • AbstractConfig

      protected AbstractConfig(ProxyPlugin<A,S,?> plugin)
      Creates an instance with a given ProxyPlugin.
      Parameters:
      plugin - the plugin
  • Method Details

    • 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:
      true if the configuration has the property, false otherwise
    • 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>
      Type Parameters:
      T - the type of the property value
      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