com.hazelcast.mapreduce.aggregation

## Class Supplier<KeyIn,ValueIn,ValueOut>

- java.lang.Object
- - com.hazelcast.mapreduce.aggregation.Supplier<KeyIn,ValueIn,ValueOut>

- Type Parameters:
    `KeyIn` - the input key type
    `ValueIn` - the input value type
    `ValueOut` - the supplied value type
  All Implemented Interfaces:
    Serializable

  Deprecated.
  Use fast-aggregations `Aggregator`

      @Deprecated
      public abstract class Supplier<KeyIn,ValueIn,ValueOut>
      extends Object
      implements Serializable

  The Supplier interface is used to supply values from input data structures like `IMap` or `MultiMap` to an aggregation. Suppliers can also be used to filter elements based on keys or values using `KeyPredicate`s or `Predicate`s.
  Additionally you can provide a `PropertyExtractor` implementation to extract or transform selected values to another value type. This is necessary if you don't want to aggregate the actual value type of the maps, but an attribute of it.

  The following examples using Java 8 Lambda syntax but everything is fully Java 6 or 7 compatible using implementations of the interfaces.

           // Select all values, no need to transform
           Supplier supplier = Supplier.all();

           // Select all values but transform to Integer
           Supplier supplier = Supplier.all((value) -> value.intValue());

           // Select only values where the value is bigger than 50
           Supplier supplier = Supplier.fromPredicate((entry) -> entry.getValue().intValue() > 50);

           // Select only values where the value is bigger than 50 and than chain it to a
           // supplier transformation to transform it into an Integer
           Supplier supplier = Supplier.fromPredicate((entry) -> entry.getValue().intValue() > 50,
                                                      Supplier.all((value) -> value.intValue()));

           // Select only values where the key starts with "Foo"
           Supplier supplier = Supplier.fromKeyPredicate((key) -> key.startsWith("Foo"));

           // Select only values where the key starts with "Foo" and than chain it to a
           // supplier transformation to transform it into an Integer
           Supplier supplier = Supplier.fromKeyPredicate((key) -> key.startsWith("Foo"),
                                                         Supplier.all((value) -> value.intValue()));

  Since:
    3.3
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Supplier()` Deprecated.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `all()` Deprecated. The predefined Supplier selects all values and does not perform any kind of data transformation.
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `all(PropertyExtractor<ValueIn,ValueOut> propertyExtractor)` Deprecated. The predefined Supplier selects all values and performs the given `PropertyExtractor`s transformation to the input data.
    `abstract ValueOut` | `apply(Map.Entry<KeyIn,ValueIn> entry)` Deprecated. The apply method is used to apply the actual filtering or extraction / transformation to the input entry. If the input value should be ignored by the aggregation, the Supplier has to return
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `fromKeyPredicate(KeyPredicate<KeyIn> keyPredicate)` Deprecated. The predefined Supplier selects values using the given `KeyPredicate` and does not perform any kind of data transformation.
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `fromKeyPredicate(KeyPredicate<KeyIn> keyPredicate, Supplier<KeyIn,ValueIn,ValueOut> chainedSupplier)` Deprecated. The predefined Supplier selects values using the given `KeyPredicate` and chains the filtered value to the given Supplier which might perform data transformation.
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `fromPredicate(Predicate<KeyIn,ValueIn> predicate)` Deprecated. The predefined Supplier selects values using the given `Predicate` and does not perform any kind of data transformation.
    `static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut>` | `fromPredicate(Predicate<KeyIn,ValueIn> predicate, Supplier<KeyIn,ValueIn,ValueOut> chainedSupplier)` Deprecated. The predefined Supplier selects values using the given `Predicate` and chains the filtered value to the given Supplier which might perform data transformation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Supplier

          public Supplier()

      Deprecated.

  - ### Method Detail

    - #### apply

          public abstract ValueOut apply(Map.Entry<KeyIn,ValueIn> entry)

      Deprecated.
      The apply method is used to apply the actual filtering or extraction / transformation to the input entry.
      If the input value should be ignored by the aggregation, the Supplier has to return

          null

      as the supplied value, therefor

          null

      is not a legal value itself!
      All custom suppliers have to be serializable: if they hold internal state, remember that the same supplier instance might be used from multiple threads concurrently.
      Parameters:
        `entry` - the entry key-value pair to supply to the aggregation
      Returns:
        the supplied value or null if value should be ignored

    - #### all

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> all()

      Deprecated.
      The predefined Supplier selects all values and does not perform any kind of data transformation. Input value types need to match the aggregations expected value type to make this Supplier work.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        all values from the underlying data structure as stored

    - #### all

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> all(PropertyExtractor<ValueIn,ValueOut> propertyExtractor)

      Deprecated.
      The predefined Supplier selects all values and performs the given `PropertyExtractor`s transformation to the input data. The returned value type of the transformation needs to match the expected value type of the aggregation.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        all values from the underlying data structure transformed using the given PropertyExtractor

    - #### fromPredicate

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> fromPredicate(Predicate<KeyIn,ValueIn> predicate)

      Deprecated.
      The predefined Supplier selects values using the given `Predicate` and does not perform any kind of data transformation. Input value types need to match the aggregations expected value type to make this Supplier work.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        selected values from the underlying data structure as stored

    - #### fromPredicate

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> fromPredicate(Predicate<KeyIn,ValueIn> predicate,
                                                                                                Supplier<KeyIn,ValueIn,ValueOut> chainedSupplier)

      Deprecated.
      The predefined Supplier selects values using the given `Predicate` and chains the filtered value to the given Supplier which might perform data transformation.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        all values from the underlying data structure, possibly transformed using the chains Supplier

    - #### fromKeyPredicate

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> fromKeyPredicate(KeyPredicate<KeyIn> keyPredicate)

      Deprecated.
      The predefined Supplier selects values using the given `KeyPredicate` and does not perform any kind of data transformation. Input value types need to match the aggregations expected value type to make this Supplier work.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        selected values from the underlying data structure as stored

    - #### fromKeyPredicate

          public static <KeyIn,ValueIn,ValueOut> Supplier<KeyIn,ValueIn,ValueOut> fromKeyPredicate(KeyPredicate<KeyIn> keyPredicate,
                                                                                                   Supplier<KeyIn,ValueIn,ValueOut> chainedSupplier)

      Deprecated.
      The predefined Supplier selects values using the given `KeyPredicate` and chains the filtered value to the given Supplier which might perform data transformation.
      Type Parameters:
        `KeyIn` - the input key type
        `ValueIn` - the input value type
        `ValueOut` - the supplied value type
      Returns:
        all values from the underlying data structure, possibly transformed using the chains Supplier

Copyright © 2018. All rights reserved.