com.gargoylesoftware.htmlunit.javascript.configuration
Class JavaScriptConfiguration

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration

public final class JavaScriptConfiguration
extends java.lang.Object

A container for all the javascript configuration information. TODO - Need to add the logic to support the browser and javascript conditionals in the Class elements.

Version:
$Revision: 1.3 $
Author:
Mike Bowler, Chris Erskine, Ahmed Ashour

Field Summary
static int DISABLED
 Constant indicating that this function/property is not used by the specified browser version
static int ENABLED
 Constant indicating that this function/property is used by the specified browser version
static int NOT_FOUND
 Constant indicating that this function/property is not defined in the configuration file
 
Method Summary
 BrowserVersion getBrowser()
  
 ClassConfiguration getClassConfiguration(java.lang.String classname)
 Get the class configuration for the supplied javascript class name
 java.lang.reflect.Method getFunctionMethod(java.lang.Class clazz, java.lang.String functionName)
 Get the method that implements the setter for the given property based upon the class object.
 java.lang.reflect.Method getFunctionMethod(java.lang.String classname, java.lang.String functionName)
 Return the method that implements the given function in the class for the given class
static java.util.Map getHtmlJavaScriptMapping()
 Return an immutable map containing the html to javascript mappings.
static JavaScriptConfiguration getInstance(BrowserVersion browserVersion)
 Return the instance that represents the configuration for the specified BrowserVersion.
 java.lang.reflect.Method getPropertyReadMethod(java.lang.Class clazz, java.lang.String propertyName)
 Get the method that implements the getter for the given property based upon the class object.
 java.lang.reflect.Method getPropertyReadMethod(java.lang.String classname, java.lang.String propertyName)
 Return the method that implements the get function for in the class for the given class
 java.lang.reflect.Method getPropertyWriteMethod(java.lang.Class clazz, java.lang.String propertyName)
 Get the method that implements the setter for the given property based upon the class object.
 java.lang.reflect.Method getPropertyWriteMethod(java.lang.String classname, java.lang.String propertyName)
 Return the method that implements the set function in the class for the given class
 java.util.Set keySet()
 Get the set of keys for the class configurations.
 boolean propertyExists(java.lang.Class clazz, java.lang.String propertyName)
 Check to see if there is an entry for the given property.
 boolean propertyExists(java.lang.String classname, java.lang.String propertyName)
 Check to see if there is an entry for the given property.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISABLED

public static final int DISABLED
Constant indicating that this function/property is not used by the specified browser version

See Also:
Constant Field Values

ENABLED

public static final int ENABLED
Constant indicating that this function/property is used by the specified browser version

See Also:
Constant Field Values

NOT_FOUND

public static final int NOT_FOUND
Constant indicating that this function/property is not defined in the configuration file

See Also:
Constant Field Values
Method Detail

getBrowser

public BrowserVersion getBrowser()
Returns:
Returns the browser.

getClassConfiguration

public ClassConfiguration getClassConfiguration(java.lang.String classname)
Get the class configuration for the supplied javascript class name

Parameters:
classname - The js class name
Returns:
ClassConfiguration

getFunctionMethod

public java.lang.reflect.Method getFunctionMethod(java.lang.Class clazz,
                                                  java.lang.String functionName)
Get the method that implements the setter for the given property based upon the class object.

Parameters:
clazz - The actual class to use as reference
functionName - The function to find the method for
Returns:
Method

getFunctionMethod

public java.lang.reflect.Method getFunctionMethod(java.lang.String classname,
                                                  java.lang.String functionName)
Return the method that implements the given function in the class for the given class

Parameters:
classname - The name of the class to work with
functionName - The function to find the method for
Returns:
Method

getHtmlJavaScriptMapping

public static java.util.Map getHtmlJavaScriptMapping()
Return an immutable map containing the html to javascript mappings. Keys are java classes for the various html classes (ie HtmlInput.class) and the values are the javascript class names (ie "Anchor").

Returns:
the mappings

getInstance

public static JavaScriptConfiguration getInstance(BrowserVersion browserVersion)
Return the instance that represents the configuration for the specified BrowserVersion. This method is synchronized to allow multithreaded access to the Javascript configuration.

Parameters:
browserVersion - The BrowserVersion
Returns:
The instance for the specified BrowserVersion

getPropertyReadMethod

public java.lang.reflect.Method getPropertyReadMethod(java.lang.Class clazz,
                                                      java.lang.String propertyName)
Get the method that implements the getter for the given property based upon the class object.

Parameters:
clazz - The actual class to use as reference
propertyName - The property to find the getter for
Returns:
Method

getPropertyReadMethod

public java.lang.reflect.Method getPropertyReadMethod(java.lang.String classname,
                                                      java.lang.String propertyName)
Return the method that implements the get function for in the class for the given class

Parameters:
classname - The name of the class to work with
propertyName - The property to find the getter for
Returns:
Method

getPropertyWriteMethod

public java.lang.reflect.Method getPropertyWriteMethod(java.lang.Class clazz,
                                                       java.lang.String propertyName)
Get the method that implements the setter for the given property based upon the class object.

Parameters:
clazz - The actual class to use as reference
propertyName - The property to find the getter for
Returns:
Method

getPropertyWriteMethod

public java.lang.reflect.Method getPropertyWriteMethod(java.lang.String classname,
                                                       java.lang.String propertyName)
Return the method that implements the set function in the class for the given class

Parameters:
classname - The name of the class to work with
propertyName - The property to find the setter for
Returns:
Method

keySet

public java.util.Set keySet()
Get the set of keys for the class configurations.

Returns:
Set

propertyExists

public boolean propertyExists(java.lang.Class clazz,
                              java.lang.String propertyName)
Check to see if there is an entry for the given property.

Parameters:
clazz - The class the property is for
propertyName - The name of the property
Returns:
boolean True if the property exists

propertyExists

public boolean propertyExists(java.lang.String classname,
                              java.lang.String propertyName)
Check to see if there is an entry for the given property.

Parameters:
classname - The class the property is for
propertyName - The name of the property
Returns:
boolean True if the property exists


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.