com.gargoylesoftware.htmlunit.javascript.configuration
Class ClassConfiguration

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

public final class ClassConfiguration
extends Object

A container for all the JavaScript configuration information.

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

Nested Class Summary
protected  class ClassConfiguration.PropertyInfo
          Class used to contain the property information if the property is readable, writable and the methods that implement the get and set functions.
 
Constructor Summary
ClassConfiguration(String hostClassName, String jsConstructor, String extendedClassName, String htmlClassName, boolean jsObject)
          Constructor.
 
Method Summary
 void addConstant(String name)
          Add the constant to the configuration.
 void addFunction(String name)
          Add the function to the configuration.
 void addProperty(String name, boolean readable, boolean writable)
          Add the property to the configuration.
 List<String> constants()
          Returns the constant list.
 boolean equals(Object obj)
          Test for value equality of the 2 objects.
 Set<String> functionKeys()
          Returns the set of keys for the defined functions.
 String getExtendedClassName()
           
 Method getFunctionMethod(String functionName)
          Gets the method that implements the given function.
 Class<? extends SimpleScriptable> getHostClass()
          Gets the class of the JavaScript host object.
 String getHtmlClassname()
           
 Method getJsConstructor()
          Gets the JavaScript constructor method in getHostClass().
protected  ClassConfiguration.PropertyInfo getPropertyInfo(String propertyName)
          Returns the PropertyInfo for the given property name.
 Method getPropertyReadMethod(String propertyName)
          Gets the method that implements the getter for the named property.
 Method getPropertyWriteMethod(String propertyName)
          Gets the method that implements the setter for the named property.
 int hashCode()
          Currently, this is the hashcode for the linkedClass name.
 boolean isJsObject()
           
 Set<String> propertyKeys()
          Returns the set of keys for the defined properties.
 void setBrowser(String propertyName, String browserName)
          Sets the browser information for this named property.
 void setExtendedClassName(String extendedClass)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassConfiguration

public ClassConfiguration(String hostClassName,
                          String jsConstructor,
                          String extendedClassName,
                          String htmlClassName,
                          boolean jsObject)
                   throws ClassNotFoundException
Constructor.

Parameters:
hostClassName - - the fully qualified name of the class implementing this functionality
jsConstructor - the constructor of method implementingClass
extendedClassName - - The name of the class that this class extends
htmlClassName - the name of the HTML class that this object supports
jsObject - boolean flag for if this object is a JavaScript object
Throws:
ClassNotFoundException - - if the implementing class is not found
Method Detail

addProperty

public void addProperty(String name,
                        boolean readable,
                        boolean writable)
Add the property to the configuration.

Parameters:
name - name of the property
readable - flag for if the property is readable
writable - flag for if the property is writable

addConstant

public void addConstant(String name)
Add the constant to the configuration.

Parameters:
name - - Name of the configuration

propertyKeys

public Set<String> propertyKeys()
Returns the set of keys for the defined properties.

Returns:
a set

functionKeys

public Set<String> functionKeys()
Returns the set of keys for the defined functions.

Returns:
a set

constants

public List<String> constants()
Returns the constant list.

Returns:
a list

addFunction

public void addFunction(String name)
Add the function to the configuration.

Parameters:
name - - Name of the function

setBrowser

public void setBrowser(String propertyName,
                       String browserName)
                throws IllegalStateException
Sets the browser information for this named property.

Parameters:
propertyName - - Name of the property to set
browserName - - Browser name to set
Throws:
IllegalStateException - - Property does not exist

getExtendedClassName

public String getExtendedClassName()
Returns:
the extendedClass

setExtendedClassName

public void setExtendedClassName(String extendedClass)
Parameters:
extendedClass - the extendedClass to set

getPropertyInfo

protected ClassConfiguration.PropertyInfo getPropertyInfo(String propertyName)
Returns the PropertyInfo for the given property name.

Parameters:
propertyName - Name of property
Returns:
the PropertyInfo for the given property name

equals

public boolean equals(Object obj)
Test for value equality of the 2 objects.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare
Returns:
true if the value of this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Currently, this is the hashcode for the linkedClass name.

Overrides:
hashCode in class Object

getPropertyReadMethod

public Method getPropertyReadMethod(String propertyName)
Gets the method that implements the getter for the named property.

Parameters:
propertyName - the name of the property
Returns:
the method that implements the getter for the named property

getPropertyWriteMethod

public Method getPropertyWriteMethod(String propertyName)
Gets the method that implements the setter for the named property.

Parameters:
propertyName - the name of the property
Returns:
the method that implements the setter for the named property

getFunctionMethod

public Method getFunctionMethod(String functionName)
Gets the method that implements the given function.

Parameters:
functionName - the name of the property
Returns:
the method that implements the given function

getHostClass

public Class<? extends SimpleScriptable> getHostClass()
Gets the class of the JavaScript host object.

Returns:
the class of the JavaScript host object

getJsConstructor

public Method getJsConstructor()
Gets the JavaScript constructor method in getHostClass().

Returns:
the JavaScript constructor method in getHostClass()

getHtmlClassname

public String getHtmlClassname()
Returns:
the htmlClassname

isJsObject

public boolean isJsObject()
Returns:
the jsObject


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.