com.hazelcast.mapreduce.aggregation
Interface PropertyExtractor<ValueIn,ValueOut>

Type Parameters:
ValueIn - the input value type
ValueOut - the extracted / transformed value type
All Superinterfaces:
Serializable

@Beta
public interface PropertyExtractor<ValueIn,ValueOut>
extends Serializable

The PropertyExtractor interface is used in suppliers to retrieve values from input value types and extract or transform them to some other type to be used in aggregations.

For Java 6 and 7:

 public class EmployeeIntTransformer implements PropertyExtractor<Employee, Integer> {
   public Integer extract(Employee value) {
       return value.getSalaryPerMonth();
   }
 }

 Supplier supplier = Supplier.all(new EmployeeIntTransformer());
 

Or in Java 8:

 Supplier supplier = Supplier.all((value) -> value.getSalaryPerMonth());
 

Since:
3.3

Method Summary
 ValueOut extract(ValueIn value)
          This method is called for every value that is about to be supplied to an aggregation (maybe filtered through an Predicate or KeyPredicate).
 

Method Detail

extract

ValueOut extract(ValueIn value)
This method is called for every value that is about to be supplied to an aggregation (maybe filtered through an Predicate or KeyPredicate). It is responsible to either transform the input value to an type of ValueOut or to extract an attribute of this type.

Parameters:
value - the input value
Returns:
the extracted / transformed value


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.