T - Object type.V - Value type.C - Context type.public interface Extractor<T,V,C>
| Modifier and Type | Method and Description |
|---|---|
ComparisonResult |
compareTo(Extractor<T,V,C> other)
Compares two extractors
|
V |
extract(C context,
Map<C,Map<Extractor<T,? super V,C>,? super V>> cache,
T... obj)
Extracts value.
|
double |
getCost() |
boolean |
isContextDependent() |
Set<Integer> |
parameterIndices() |
V extract(C context, Map<C,Map<Extractor<T,? super V,C>,? super V>> cache, T... obj)
context - Extraction context. Extraction context may provide source for constants for comparison
with object values.cache - Cache of values extracted from the source object for the given context.
Composite extractors can use cache to find already extracted values and to store extracted values.
For example extractor which extracts object area as obj.getWidth()*obj.getHeight() may find that width was already
extracted and getWidth() doesn't have to be invoked. So it invokes getHeight() and stores
returned value to the cache. It also calculates object area and stores it to the cache. A particular cache instance
is valid only for a particular obj array, i.e. it can be re-used between extractors but not between arguments.obj - Source objects.Set<Integer> parameterIndices()
boolean isContextDependent()
ComparisonResult compareTo(Extractor<T,V,C> other)
other - Other extractordouble getCost()