public interface ExtractorBuilder
ValueExtractor
for a provided cache name, target and property chain (realize(String, int, String)
).
To determine the appropriate ValueExtractor implementations may
need to decipher cache type information, which should be discernible from
the provided cache name and nTarget
(KEY
or VALUE
). The property
chain (sProperties)
represents a chain of calls from the root type
(key or value) down the type hierarchy.
Implementations may be able to optimize the ValueExtractors used by CohQL by providing a mapping of a logical property name to a ValueExtractor that can optimally (without deserializing the entire key or value) extract the relevant property. For example, an implementation able to map properties to POF indices could convert a property chain to a POF path. Assuming a Person object is the value stored in a cache the table below illustrates possible implementations:
Property Chain | Unoptimized | Optimized |
---|---|---|
value().address.homeTel.areaCode |
ChainedExtractor(ReflectionExtractor(getAddress),
ReflectionExtractor(getHomeTel), ReflectionExtractor(getAreaCode)) |
PofExtractor(PofNavigator(2, 5, 7)) |
ValueExtractor
Modifier and Type | Method and Description |
---|---|
ValueExtractor |
realize(String sCacheName,
int nTarget,
String sProperties)
Create a
ValueExtractor for the given cache name, target and property chain. |
ValueExtractor realize(String sCacheName, int nTarget, String sProperties)
ValueExtractor
for the given cache name, target and property chain.sCacheName
- the name of the cache the ValueExtractor will be invoked againstnTarget
- the target for the ValueExtractorsProperties
- the path to the property value to extractValueExtractor
for the given cache name, target and properties