org.epics.pvmanager
Class DataSourceTypeSupport
java.lang.Object
org.epics.pvmanager.DataSourceTypeSupport
- Direct Known Subclasses:
- JCATypeSupport
public class DataSourceTypeSupport
- extends java.lang.Object
The type support for a datasource. This optional class is provided to help
create a more flexible type support in a datasource, so that support
for individual types is done through runtime configuration. It provides
default implementation for matching typeAdapters from the desired cache
and connection payload.
- Author:
- carcassi
Method Summary |
protected
|
find(java.util.Collection<T> typeAdapters,
ValueCache<?> cache,
C connection)
Given a collection of type datapters, finds the one that can store
data in the cache given the channel information described in the
connection payload. |
protected java.lang.String |
formatMessage(ValueCache<?> cache,
java.lang.Object connection,
int match,
java.util.List<? extends DataSourceTypeAdapter<?,?>> matchedConverters)
Formats the error message in case of not unique match. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DataSourceTypeSupport
public DataSourceTypeSupport()
find
protected <C,T extends DataSourceTypeAdapter<? super C,?>> T find(java.util.Collection<T> typeAdapters,
ValueCache<?> cache,
C connection)
- Given a collection of type datapters, finds the one that can store
data in the cache given the channel information described in the
connection payload. If there isn't a unique match, an exception
is thrown.
- Type Parameters:
C
- type of connection payloadT
- datasource specific type adapter type- Parameters:
typeAdapters
- a collection of type adapterscache
- the cache where to store the dataconnection
- the connection payload
- Returns:
- 0 if the type was not matched
formatMessage
protected java.lang.String formatMessage(ValueCache<?> cache,
java.lang.Object connection,
int match,
java.util.List<? extends DataSourceTypeAdapter<?,?>> matchedConverters)
- Formats the error message in case of not unique match. This
allows data sources to give more specific error messages.
- Parameters:
cache
- the cache used for the matchconnection
- the connection payload used for the matchmatch
- the result of the matchmatchedConverters
- the matched converters; will either be 0 (no match)
or more than 1 (non unique match)
- Returns:
- the message to be passed with the exception