Package org.apache.sis.storage
Class DataStoreProvider.ProberList<S,N>
java.lang.Object
org.apache.sis.storage.DataStoreProvider.ProberList<S,N>
- Type Parameters:
S- the source type of the original probe.N- the source type of the next probe to try as an alternative.
- All Implemented Interfaces:
DataStoreProvider.Prober<S>
- Enclosing class:
- DataStoreProvider
private static final class DataStoreProvider.ProberList<S,N>
extends Object
implements DataStoreProvider.Prober<S>
Implementation of the composed probe returned by
DataStoreProvider.Prober.orElse(Class, Prober).
Instances of this class a nodes in a linked list.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataStoreProvider.Prober<S>The main probe to try first.(package private) DataStoreProvider.Prober<? super N>The probe to try next if the first probe cannot be executed.Type of input expected by the next probe. -
Constructor Summary
ConstructorsConstructorDescriptionProberList(DataStoreProvider.Prober<S> first, Class<N> type, DataStoreProvider.Prober<? super N> next) Creates a new composed probe as a root node of a linked list. -
Method Summary
Modifier and TypeMethodDescriptionorElse(Class<A> type, DataStoreProvider.Prober<? super A> prober) Appends a new probe alternative at the end of this linked list.Forward to the primary probe.
-
Field Details
-
first
The main probe to try first. -
next
DataStoreProvider.Prober<? super N> nextThe probe to try next if the first probe cannot be executed. -
type
Type of input expected by the next probe.
-
-
Constructor Details
-
ProberList
ProberList(DataStoreProvider.Prober<S> first, Class<N> type, DataStoreProvider.Prober<? super N> next) Creates a new composed probe as a root node of a linked list.
-
-
Method Details
-
test
Forward to the primary probe.- Specified by:
testin interfaceDataStoreProvider.Prober<S>- 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
public <A> DataStoreProvider.Prober<S> orElse(Class<A> type, DataStoreProvider.Prober<? super A> prober) Appends a new probe alternative at the end of this linked list.- Specified by:
orElsein interfaceDataStoreProvider.Prober<S>- Type Parameters:
A- the compile-time type of thetypeargument (the source or storage type).- Parameters:
type- the desired type as one ofByteBuffer,DataInput, etc.prober- 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.
-