Class FilterBuilder

java.lang.Object
com.fluxtion.ext.streaming.builder.factory.FilterBuilder

public class FilterBuilder
extends java.lang.Object
Utility functions for creating filtered streams.
Author:
Greg Higgins [email protected]
  • Constructor Summary

    Constructors 
    Constructor Description
    FilterBuilder()  
  • Method Summary

    Modifier and Type Method Description
    static <T,​ S> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(com.fluxtion.api.partition.LambdaReflection.SerializableFunction<T,​S> supplier, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends S,​java.lang.Boolean> filter)
    Applies a filter function on a property of an incoming event stream, and only produces an output if the function returns true.
    static <T,​ S> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(com.fluxtion.api.partition.LambdaReflection.SerializableSupplier<S> supplier, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends S,​java.lang.Boolean> filter)
    Applies a filter function on a property of an incoming event stream, and only produces an output if the function returns true.
    static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(java.lang.Class<T> clazz, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends T,​java.lang.Boolean> filter)
    Applies a filter function to an incoming event stream, and only produces an output if the function returns true.Creates a subscription for the input stream type
    static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(java.lang.Class<T> clazz, com.fluxtion.ext.streaming.api.Test test)
    Applies a test function before streaming the incoming event.
    static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(T instance, com.fluxtion.ext.streaming.api.Test test)
    Applies a test function before streaming the incoming event.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • filter

      public static <T,​ S> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(com.fluxtion.api.partition.LambdaReflection.SerializableFunction<T,​S> supplier, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends S,​java.lang.Boolean> filter)
      Applies a filter function on a property of an incoming event stream, and only produces an output if the function returns true. Creates a subscription for the input stream type
      Type Parameters:
      T - The input stream type
      S - The type of the property to extract and apply a filer functionó to
      Parameters:
      supplier - The instance stream to filter
      filter - The filter function applied to the property of the incoming stream
      Returns:
      The filtered stream
    • filter

      public static <T,​ S> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(com.fluxtion.api.partition.LambdaReflection.SerializableSupplier<S> supplier, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends S,​java.lang.Boolean> filter)
      Applies a filter function on a property of an incoming event stream, and only produces an output if the function returns true. Streams the supplied instance to the filter function
      Type Parameters:
      T - The input stream type
      S - The type of the property to extract and apply a filer function to
      Parameters:
      supplier - The instance stream to filter
      filter - The filter function applied to the property of the incoming stream
      Returns:
      The filtered stream
    • filter

      public static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(java.lang.Class<T> clazz, com.fluxtion.api.partition.LambdaReflection.SerializableFunction<? extends T,​java.lang.Boolean> filter)
      Applies a filter function to an incoming event stream, and only produces an output if the function returns true.Creates a subscription for the input stream type
      Type Parameters:
      T - The input stream type
      Parameters:
      clazz - the class to create a subscription for
      filter - The filter function applied to the property of the incoming stream
      Returns:
      The filtered stream
    • filter

      public static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(java.lang.Class<T> clazz, com.fluxtion.ext.streaming.api.Test test)
      Applies a test function before streaming the incoming event. The test function can be disconnected to the input stream to filter. The test function is applied whenever the input stream updates and not when inputs to the test may change. For example a stream of prices may only publish during certain hours, the test passes or fails depending upon the time.
      Type Parameters:
      T - The output type of the filtered stream
      Parameters:
      clazz - The input class type to create an input strem from
      test - The test to apply, only a passed test
      Returns:
      The filtered stream
    • filter

      public static <T> com.fluxtion.ext.streaming.api.FilterWrapper<T> filter​(T instance, com.fluxtion.ext.streaming.api.Test test)
      Applies a test function before streaming the incoming event. The test function can be disconnected to the input stream to filter. The test function is applied whenever the input stream updates and not when inputs to the test may change. For example a stream of prices may only publish during certain hours, the test passes or fails depending upon the time.
      Type Parameters:
      T - The output type of the filtered stream
      Parameters:
      instance - The input instance to create a filtered stream from
      test - The test to apply, only a passed test
      Returns:
      The filtered stream