com.ibm.itim.fesiextensions
Class JSGlobalObjectFactory

java.lang.Object
  |
  +--com.ibm.itim.fesiextensions.JSGlobalObjectFactory
All Implemented Interfaces:
JSObjectFactory

public class JSGlobalObjectFactory
extends java.lang.Object
implements JSObjectFactory

JSAttributeValuesFactory provides an interface for creating JS objects that represent AttributeValues. The given AttributeValue is defined as a named JS object.


Field Summary
static java.lang.String UNSUPPORTED_CONVERSION
          Constant for the error message indicating an invalid conversion between JSObjects and Java Objects.
 
Fields inherited from interface com.ibm.itim.fesiextensions.JSObjectFactory
CLASS_NAME
 
Constructor Summary
JSGlobalObjectFactory()
           
 
Method Summary
 java.lang.Object createJavaObject(java.lang.String name, JSObject o)
          Creates a Java object from the specified JavaScript object.
 JSObject createScriptObject(JSGlobalObject go, JSObject parent, java.lang.String name, java.lang.Object item)
          Creates a named object that can be used in the client's script.
 void registerObjectFactory(java.lang.String className, JSObjectFactory factory)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSUPPORTED_CONVERSION

public static final java.lang.String UNSUPPORTED_CONVERSION
Constant for the error message indicating an invalid conversion between JSObjects and Java Objects.
Constructor Detail

JSGlobalObjectFactory

public JSGlobalObjectFactory()
Method Detail

registerObjectFactory

public void registerObjectFactory(java.lang.String className,
                                  JSObjectFactory factory)

createScriptObject

public JSObject createScriptObject(JSGlobalObject go,
                                   JSObject parent,
                                   java.lang.String name,
                                   java.lang.Object item)
                            throws JSException
Creates a named object that can be used in the client's script. This method differes from setContextItem in that it will translate the given java object to an object that is compatible with the scripting language implementation and the result can be used in the client scripts, not just by the script engine extensions.
Specified by:
createScriptObject in interface JSObjectFactory
Parameters:
go - JSGlobalObject as calling context.
parent - JSObject to be registered as a member of. Same as go if global.
name - Name of the object in the scripting environment
item - Object that will be made available as a script object
Returns:
JSObject representing the given object.
Throws:
JSException - when the object can not be converted into a format that can be used within the script environment

createJavaObject

public java.lang.Object createJavaObject(java.lang.String name,
                                         JSObject o)
                                  throws JSException
Creates a Java object from the specified JavaScript object. This method is optional. If the factory does not implement it, it must throw an UnsupportedOperationException.
Specified by:
createJavaObject in interface JSObjectFactory
Parameters:
name - Name of the JavaScript object. Can be empty.
o - JSObject to convert from.
Returns:
Java object that represents the JSObject.
Throws:
JSException - if the specified JSObject is malformed or not compatible with this factory.