Interface ConnectorExtensionDescriptor

All Known Implementing Classes:
ConnectorExtensionDescriptor.DefaultConnectorExtension

public interface ConnectorExtensionDescriptor
Descriptor that allows for connector-specific extensions. An application may have multiple extensions for different connectors so we need to distinguish them. Shall not be used within connector constructors. The holding service shall set an instance identification on the respective connector instance and check for it in the implementing ConnectorExtensionDescriptor, ideally using a service identification provided during through code generation.
Author:
Holger Eichelberger, SSE
  • Method Details

    • handlesConnectorForExtension

      boolean handlesConnectorForExtension(String identification)
      Returns whether this extension handles the given connector.
      Parameters:
      identification - the connector identification
      Returns:
      true if handled, false else
    • getConnectorExtension

      <T> T getConnectorExtension(Class<T> cls, Supplier<T> dflt)
      Returns the extension.
      Type Parameters:
      T - the type of the extension
      Parameters:
      cls - the requested extension type
      dflt - the default value if none was found
      Returns:
      dflt or the extension value
    • getExtension

      static <T> T getExtension(Connector<?,?,?,?> connector, Class<T> cls, Supplier<T> dflt)
      Returns a connector extension.
      Type Parameters:
      T - the type of the extension
      Parameters:
      connector - the connector requesting the extension, supplying the id through Connector.getInstanceIdentification()
      cls - the requested extension type
      dflt - the default value if none was found
      Returns:
      dflt or the extension value
    • getExtension

      static <T> T getExtension(String id, Class<T> cls, Supplier<T> dflt)
      Returns a connector extension.
      Type Parameters:
      T - the type of the extension
      Parameters:
      id - the connector instance identification to be matched by the related extension
      cls - the requested extension type
      dflt - the default value if none was found
      Returns:
      dflt or the extension value
    • getConnectorExtensionValue

      static <T, V> T getConnectorExtensionValue(Class<T> cls, Supplier<V> val, Supplier<T> dflt)
      Generic simple implementation of getConnectorExtension(Class, Supplier).
      Type Parameters:
      T - the type provided by getConnectorExtension(Class, Supplier)
      V - the value type delivered by the implementation
      Parameters:
      cls - the type class provided by getConnectorExtension(Class, Supplier)
      val - the value provided called if cls and valClass are the same, result must not be null
      dflt - the default value provided called if cls and valClass are not the same
      Returns:
      the value provided by val or dflt