Class SingleAttributeProjection<K,V,R>
java.lang.Object
com.loomcache.server.compute.SingleAttributeProjection<K,V,R>
- Type Parameters:
K- the type of the keyV- the type of the valueR- the type of the projected attribute
- All Implemented Interfaces:
Projection<K,V, R>
Built-in projection that extracts a single attribute from values using a function.
Usage:
Projectioninvalid input: '<'String, Person, String> nameProj = new SingleAttributeProjectioninvalid input: '<'>(Person::getName); Listnames = executor.project(nameProj);
-
Constructor Summary
ConstructorsConstructorDescriptionSingleAttributeProjection(Function<V, R> extractor) Create a new single attribute projection. -
Method Summary
-
Constructor Details
-
SingleAttributeProjection
Create a new single attribute projection.- Parameters:
extractor- the function to extract the attribute from the value (must not be null)- Throws:
NullPointerException- if extractor is null
-
-
Method Details
-
transform
Description copied from interface:ProjectionTransform a map entry to the projected result.- Specified by:
transformin interfaceProjection<K,V, R> - Parameters:
entry- the detached, immutable entry snapshot to transform; the server provides a read-only snapshot, and direct callers must do the same because invokingMap.Entry.setValue(Object)never updates cache state and is unsupported- Returns:
- the projected result
-