Class SupplierChain.Handler<I,O>

java.lang.Object
overit.geocall.util.SupplierChain.Handler<I,O>
Type Parameters:
I - type of the input parameter
O - type of the output results
Direct Known Subclasses:
ChapterHandler, GrantsHandler, LicenseModuleHandler, OperationModeHandler, PermissionsHandler
Enclosing class:
SupplierChain<I,O>

public abstract static class SupplierChain.Handler<I,O> extends Object
Interface that defined the
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(I input)
    Get the value from this handler if it is able to handle the input parameter.
    protected Stream<O>
    Get the stream containing all values that this handler can manage.
    final boolean
    Check if there's another handler in the chain after this
    Get the next handler in the chain
    final Stream<O>
    Get the stream containing all values that this handler and the following handlers can manage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Handler

      public Handler()
  • Method Details

    • get

      public O get(I input)
      Get the value from this handler if it is able to handle the input parameter. Implementation note: the subclass should invoke the super implementation if it can not handle the request
      
       {@literal @}Override
       public O get(I input) {
           if (!canHandle(input)) return super.get(input);
           // handle the request
       }
       
      Parameters:
      input - the input parameter
      Returns:
      the output value or null if the input can not be handled
    • next

      public final SupplierChain.Handler<I,O> next()
      Get the next handler in the chain
      Returns:
      the next handler in the chain or null if there's none
    • hasNext

      public final boolean hasNext()
      Check if there's another handler in the chain after this
      Returns:
      true if there is another handler in the chain, false otherwise
    • stream

      public final Stream<O> stream()
      Get the stream containing all values that this handler and the following handlers can manage.
      Returns:
      the stream containing all the output values, or Stream.empty() if there's none.
    • getAll

      protected Stream<O> getAll()
      Get the stream containing all values that this handler can manage. For example, if this handler manages the translations contained in a dictionary, this method should return a stream for all dictionary entries.
      Returns:
      the stream containing all the output values, or Stream.empty() if there's none.