public class OXPathMemoizer extends Object implements InvocationHandler, OXPathCache
The class here has been adapted from its original verison to update generics to parameterized types (rather than the
raws of pre-Java 1.5). In addition, for efficiency, we memoize methods only whose first parameter is a
DOMNode
instance (each such method signature, then, must be unique as we don't account for the name). This
way, we can cache by the containing document, rather than the method.
Modifier and Type | Class and Description |
---|---|
static interface |
OXPathMemoizer.DocumentProvider |
Modifier and Type | Method and Description |
---|---|
Boolean |
clear(DOMDocument page)
Clears all memoized data for the input
DOMDocument . |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
static <T extends OXPathCache> |
memoize(T cache) |
static <T extends OXPathCache> |
memoize(T cache,
OXPathMemoizer.DocumentProvider documentProvider) |
public static <T extends OXPathCache> T memoize(T cache)
public static <T extends OXPathCache> T memoize(T cache, OXPathMemoizer.DocumentProvider documentProvider)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
public Boolean clear(DOMDocument page)
OXPathCache
DOMDocument
. Will be overridden as long as a proxy object is used
(should always be used for OXPath classes overridding this method).clear
in interface OXPathCache
page
- DOMDocument
we are removing all memoized results for, presumably because the page is being closed
in PAATCopyright © 2020 OXPath Team. All rights reserved.