Interface DataStoreProvider.Prober<S>

Type Parameters:
S - the source type as one of Byte­Buffer, Data­Input or other classes documented in Storage­Connector​.get­Storage­As(Class).
Enclosing class:
Data­Store­Provider
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface protected static interface DataStoreProvider.Prober<S>
An action to execute for testing if a Storage­Connector input can be read. This action is invoked by Data­Store­Provider​.probe­Content(Storage­Connector, Class, Prober) with an input of the type <S> specified to the probe(…) method. The Data­Store­Provider is responsible for restoring the input to its initial position after the probe action completed.
Since:
1.2
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    or­Else(Class<A> type, Data­Store­Provider​.Prober<? super A> alternative)
    Returns a composed probe that attempts, in sequence, this probe followed by the alternative probe if the first probe can not be executed.
    test(S input)
    Probes the given input and returns an indication about whether that input is supported.
  • Method Details

    • test

      ProbeResult test(S input) throws Exception
      Probes the given input and returns an indication about whether that input is supported. This method may return SUPPORTED if 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 a Byte­Buffer or a Data­Input.
      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 can not be executed. The alternative probe is tried if and only if one of the following conditions is true: If any probe throws an exception, the exception is propagated (the alternative probe is not a fallback executed if this probe threw an exception).
      Type Parameters:
      A - the compile-time type of the type argument (the source or storage type).
      Parameters:
      type - the desired type as one of Byte­Buffer, Data­Input, 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 can not be executed.