Class AbstractJavaScriptConfiguration
- java.lang.Object
-
- org.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration
-
- Direct Known Subclasses:
JavaScriptConfiguration
,ProxyAutoConfigJavaScriptConfiguration
public abstract class AbstractJavaScriptConfiguration extends java.lang.Object
An abstract container for all the JavaScript configuration information.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,ClassConfiguration>
configuration_
private java.util.Map<java.lang.Class<?>,java.lang.Class<? extends HtmlUnitScriptable>>
domJavaScriptMap_
private static org.apache.commons.logging.Log
LOG
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJavaScriptConfiguration(BrowserVersion browser)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<ClassConfiguration>
getAll()
Gets all the configurations.static ClassConfiguration
getClassConfiguration(java.lang.Class<? extends HtmlUnitScriptable> klass, BrowserVersion browserVersion)
Returns the class configuration of the givenklass
.ClassConfiguration
getClassConfiguration(java.lang.String hostClassName)
Gets the class configuration for the supplied JavaScript class name.protected abstract java.lang.Class<? extends HtmlUnitScriptable>[]
getClasses()
java.lang.Class<? extends HtmlUnitScriptable>
getDomJavaScriptMappingFor(java.lang.Class<?> clazz)
Returns an immutable map containing the DOM to JavaScript mappings.static boolean
isCompatible(SupportedBrowser browser1, SupportedBrowser browser2)
Returns whether the twoSupportedBrowser
are compatible or not.private static boolean
isSupported(SupportedBrowser[] browsers, SupportedBrowser expectedBrowser)
private static void
process(ClassConfiguration classConfiguration, SupportedBrowser expectedBrowser)
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
domJavaScriptMap_
private java.util.Map<java.lang.Class<?>,java.lang.Class<? extends HtmlUnitScriptable>> domJavaScriptMap_
-
configuration_
private final java.util.Map<java.lang.String,ClassConfiguration> configuration_
-
-
Constructor Detail
-
AbstractJavaScriptConfiguration
protected AbstractJavaScriptConfiguration(BrowserVersion browser)
Constructor.- Parameters:
browser
- the browser version to use
-
-
Method Detail
-
getClasses
protected abstract java.lang.Class<? extends HtmlUnitScriptable>[] getClasses()
- Returns:
- the classes configured by this configuration
-
getAll
public java.lang.Iterable<ClassConfiguration> getAll()
Gets all the configurations.- Returns:
- the class configurations
-
getClassConfiguration
public static ClassConfiguration getClassConfiguration(java.lang.Class<? extends HtmlUnitScriptable> klass, BrowserVersion browserVersion)
Returns the class configuration of the givenklass
.- Parameters:
klass
- the classbrowserVersion
- the browser version- Returns:
- the class configuration
-
process
private static void process(ClassConfiguration classConfiguration, SupportedBrowser expectedBrowser)
-
isSupported
private static boolean isSupported(SupportedBrowser[] browsers, SupportedBrowser expectedBrowser)
-
isCompatible
public static boolean isCompatible(SupportedBrowser browser1, SupportedBrowser browser2)
Returns whether the twoSupportedBrowser
are compatible or not.- Parameters:
browser1
- the firstSupportedBrowser
browser2
- the secondSupportedBrowser
- Returns:
- whether the two
SupportedBrowser
are compatible or not
-
getClassConfiguration
public ClassConfiguration getClassConfiguration(java.lang.String hostClassName)
Gets the class configuration for the supplied JavaScript class name.- Parameters:
hostClassName
- the JavaScript class name- Returns:
- the class configuration for the supplied JavaScript class name
-
getDomJavaScriptMappingFor
public java.lang.Class<? extends HtmlUnitScriptable> getDomJavaScriptMappingFor(java.lang.Class<?> clazz)
Returns an immutable map containing the DOM to JavaScript mappings. Keys are java classes for the various DOM classes (e.g. HtmlInput.class) and the values are the JavaScript class names (e.g. "HTMLAnchorElement").- Parameters:
clazz
- the class to get the scriptable for- Returns:
- the mappings
-
-