- Type Parameters:
S- the source type as one ofByteBuffer,DataInputor other classes documented inStorageConnector.getStorageAs(Class).
- Enclosing class:
DataStoreProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An action to execute for testing if a
StorageConnector input can be read.
This action is invoked by DataStoreProvider.probeContent(StorageConnector, Class, Prober)
with an input of the type <S> specified to the probe(…) method.
The DataStoreProvider is responsible for restoring the input to its initial position
after the probe action completed.- Since:
- 1.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault <A> DataStoreProvider.Prober<S> orElse(Class<A> type, DataStoreProvider.Prober<? super A> alternative) Returns a composed probe that attempts, in sequence, this probe followed by the alternative probe if the first probe cannot be executed.Probes the given input and returns an indication about whether that input is supported.
-
Method Details
-
test
Probes the given input and returns an indication about whether that input is supported. This method may returnSUPPORTEDif there is reasonable chance of success based on a brief inspection of the given input; the supported status does not need to be guaranteed.- Parameters:
input- the input to probe. This is for example aByteBufferor aDataInput.- Returns:
- the result of executing the probe action with the given source. Should not be null.
- Throws:
Exception- if an error occurred during the execution of the probe action.
-
orElse
default <A> DataStoreProvider.Prober<S> orElse(Class<A> type, DataStoreProvider.Prober<? super A> alternative) Returns a composed probe that attempts, in sequence, this probe followed by the alternative probe if the first probe cannot be executed. The alternative probe is tried if and only if one of the following conditions is true:- The storage connector cannot provide an input of the type requested by this probe.
- This probe
test(S)method returnedProbeResult.UNDETERMINED.
- Type Parameters:
A- the compile-time type of thetypeargument (the source or storage type).- Parameters:
type- the desired type as one ofByteBuffer,DataInput, etc.alternative- the test to apply on the source of the given type.- Returns:
- a composed probe that attempts the given probe if this probe cannot be executed.
-