Module org.htmlunit.cyberneko
Package org.htmlunit.cyberneko
Class HTMLElements.HTMLElementsWithCache
java.lang.Object
org.htmlunit.cyberneko.HTMLElements.HTMLElementsWithCache
- All Implemented Interfaces:
HTMLElementsProvider
- Enclosing class:
- HTMLElements
public static class HTMLElements.HTMLElementsWithCache
extends Object
implements HTMLElementsProvider
An implementation of
HTMLElementsProvider that wraps an HTMLElements
instance and adds a simple cache for unknown element lookups.
This class is optimized for repeated element name lookups, especially for names that are not present in the known elements set. It avoids repeated lowercasing and unnecessary lookups for unknown elements by caching misses.
This implementation is not thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetElement(String ename) getElement(String ename, HTMLElements.Element elementIfNotFound) getElementLC(String enameLC, HTMLElements.Element elementIfNotFound)
-
Constructor Details
-
HTMLElementsWithCache
-
-
Method Details
-
getElement
- Specified by:
getElementin interfaceHTMLElementsProvider- Parameters:
ename- the element name.- Returns:
- the element information for the specified element name.
-
getElement
- Specified by:
getElementin interfaceHTMLElementsProvider- Parameters:
ename- the element name.elementIfNotFound- the default element to return if not found.- Returns:
- the element information for the specified element name.
-
getElementLC
- Specified by:
getElementLCin interfaceHTMLElementsProvider- Parameters:
enameLC- the element name in lower caseelementIfNotFound- the default element to return if not found.- Returns:
- the element information for the specified element name.
-