Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ValueAndPathNode<O> {
Node getPathNode();
O getValue();
}
interface SingleValueExtractor<I, 0> {
ValueAndPathNode<O> extractValue(I input);
}
interface MultiValueExtractor<I, 0> {
Iterator<ValueAndPathNode<O>> extractValue(I input);
}
// default impls
class MapExtractor implements MultiValueExtractor<Map, Object> {
extractValue() {
return map key and value alternating; with the right node and value
}
}
class ObjectRefExtractor implements SingleValueExtractor<Object, Object> {
extractValue(Object v) {
return v;
}
}
class OptionalRefExtractor implements SingleValueExtractor<Optional, Object> {
extractValue(Optional v) {
return v.get();
}
}
// user-custom extractors
class ThreeTupleExtractor implements MultiValueExtractor<ThreeTuple, Object> {
extractValue() {
return iterator with the three elements
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.