public class Extractors
extends java.lang.Object
| Constructor and Description |
|---|
Extractors() |
| Modifier and Type | Method and Description |
|---|---|
static <R> Extractor<java.lang.Iterable<R>,R> |
at(int pos)
Iterate to position and retieve value at position in an iterable data structure.
|
static <T,R> Extractor<T,R> |
decompose() |
static <R> Extractor<?,R> |
first()
Return element or first element in an Iterable.
|
static <R> Extractor<java.util.List<R>,R> |
get(int pos)
Look up element at position in a list
|
static <K,R> Extractor<java.util.Map<K,R>,R> |
get(K key) |
static <T,R> Extractor<T,R> |
memoised(Extractor<T,R> extractor)
An extractor that caches the extraction result
|
static <V1,V2> Extractor<java.lang.Iterable,Two<V1,V2>> |
of(int v1,
int v2)
An extractor that will generte a Tuple2 with two values at the specified index.
|
static <T,R> void |
registerDecompositionFunction(java.lang.Class<T> c,
java.util.function.Function<T,R> f)
Register decomposition function in standard hashmap
Global mutable state - use with care
|
static <R> Extractor<R,R> |
same() |
public static final <T,R> void registerDecompositionFunction(java.lang.Class<T> c,
java.util.function.Function<T,R> f)
c - Class to decomposef - Function to do decompositionpublic static final <T,R> Extractor<T,R> memoised(Extractor<T,R> extractor)
extractor - to memoise (cache result of)public static final <T,R> Extractor<T,R> decompose()
public static final <V1,V2> Extractor<java.lang.Iterable,Two<V1,V2>> of(int v1, int v2)
v1 - position of the first element to extractv2 - position of the second element to extractpublic static final <R> Extractor<?,R> first()
public static final <R> Extractor<java.lang.Iterable<R>,R> at(int pos)
pos - Position to extractpublic static final <R> Extractor<java.util.List<R>,R> get(int pos)
pos - Position to extract element frompublic static final <K,R> Extractor<java.util.Map<K,R>,R> get(K key)
key - Look up a value from a mappublic static final <R> Extractor<R,R> same()