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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA default implementation ofConnectorExtensionDescriptorchecking for identifier equality and providing the extension value throughgetConnectorExtensionValue(Class, Supplier, Supplier). -
Method Summary
Modifier and TypeMethodDescription<T> TgetConnectorExtension(Class<T> cls, Supplier<T> dflt) Returns the extension.static <T,V> T getConnectorExtensionValue(Class<T> cls, Supplier<V> val, Supplier<T> dflt) Generic simple implementation ofgetConnectorExtension(Class, Supplier).static <T> TgetExtension(Connector<?, ?, ?, ?> connector, Class<T> cls, Supplier<T> dflt) Returns a connector extension.static <T> TgetExtension(String id, Class<T> cls, Supplier<T> dflt) Returns a connector extension.booleanhandlesConnectorForExtension(String identification) Returns whether this extension handles the given connector.
-
Method Details
-
handlesConnectorForExtension
Returns whether this extension handles the given connector.- Parameters:
identification- the connector identification- Returns:
trueif handled,falseelse
-
getConnectorExtension
Returns the extension.- Type Parameters:
T- the type of the extension- Parameters:
cls- the requested extension typedflt- the default value if none was found- Returns:
dfltor the extension value
-
getExtension
Returns a connector extension.- Type Parameters:
T- the type of the extension- Parameters:
connector- the connector requesting the extension, supplying the id throughConnector.getInstanceIdentification()cls- the requested extension typedflt- the default value if none was found- Returns:
dfltor the extension value
-
getExtension
Returns a connector extension.- Type Parameters:
T- the type of the extension- Parameters:
id- the connector instance identification to be matched by the related extensioncls- the requested extension typedflt- the default value if none was found- Returns:
dfltor the extension value
-
getConnectorExtensionValue
Generic simple implementation ofgetConnectorExtension(Class, Supplier).- Type Parameters:
T- the type provided bygetConnectorExtension(Class, Supplier)V- the value type delivered by the implementation- Parameters:
cls- the type class provided bygetConnectorExtension(Class, Supplier)val- the value provided called ifclsandvalClassare the same, result must not be nulldflt- the default value provided called ifclsandvalClassare not the same- Returns:
- the value provided by
valordflt
-