Class ConnectorInputTypeAdapter<S>
- java.lang.Object
-
- de.iip_ecosphere.platform.connectors.types.ConnectorInputTypeAdapter<S>
-
- Type Parameters:
S- the source type (seeInputTypeTranslator)
- All Implemented Interfaces:
ModelAccessProvider,ConnectorInputTypeTranslator<S,byte[]>,de.iip_ecosphere.platform.transport.serialization.InputTypeTranslator<S,byte[]>
public class ConnectorInputTypeAdapter<S> extends java.lang.Object implements ConnectorInputTypeTranslator<S,byte[]>
Adapts a basic input translator/serializer for reuse.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.connectors.model.ModelAccessProvider
ModelAccessProvider.IOModelAccessFunction, ModelAccessProvider.IOVoidFunction
-
-
Field Summary
Fields Modifier and Type Field Description private ModelAccessmodelAccessprivate de.iip_ecosphere.platform.transport.serialization.Serializer<S>serializer
-
Constructor Summary
Constructors Constructor Description ConnectorInputTypeAdapter(de.iip_ecosphere.platform.transport.serialization.Serializer<S> serializer)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]from(S data)ModelAccessgetModelAccess()Returns the model access instance to be used during type translations.java.lang.Class<? extends byte[]>getSourceType()Returns the source type.java.lang.Class<? extends S>getTargetType()Returns the target type.voidsetModelAccess(ModelAccess modelAccess)Defines the model access.
-
-
-
Field Detail
-
serializer
private de.iip_ecosphere.platform.transport.serialization.Serializer<S> serializer
-
modelAccess
private ModelAccess modelAccess
-
-
Constructor Detail
-
ConnectorInputTypeAdapter
public ConnectorInputTypeAdapter(de.iip_ecosphere.platform.transport.serialization.Serializer<S> serializer)
Creates an instance.- Parameters:
serializer- the serializer to adapt
-
-
Method Detail
-
from
public byte[] from(S data) throws java.io.IOException
- Specified by:
fromin interfacede.iip_ecosphere.platform.transport.serialization.InputTypeTranslator<S,byte[]>- Throws:
java.io.IOException
-
getModelAccess
public ModelAccess getModelAccess()
Description copied from interface:ModelAccessProviderReturns the model access instance to be used during type translations.- Specified by:
getModelAccessin interfaceModelAccessProvider- Returns:
- the model access instance, may be null (see
MachineConnector.hasModel())
-
setModelAccess
public void setModelAccess(ModelAccess modelAccess)
Description copied from interface:ModelAccessProviderDefines the model access. Handle with care, shall be called (indirectly) by the connector only.- Specified by:
setModelAccessin interfaceModelAccessProvider- Parameters:
modelAccess- the model access
-
getSourceType
public java.lang.Class<? extends byte[]> getSourceType()
Description copied from interface:ConnectorInputTypeTranslatorReturns the source type.- Specified by:
getSourceTypein interfaceConnectorInputTypeTranslator<S,byte[]>- Returns:
- the source type
-
getTargetType
public java.lang.Class<? extends S> getTargetType()
Description copied from interface:ConnectorInputTypeTranslatorReturns the target type.- Specified by:
getTargetTypein interfaceConnectorInputTypeTranslator<S,byte[]>- Returns:
- the target type
-
-