com.wm.data
Class IDataFactory

java.lang.Object
  extended by com.wm.data.IDataFactory

public class IDataFactory
extends java.lang.Object

This class provides methods for creating an IData object.

See Also:
IData, IDataFactory, IDataHashCursor, IDataTreeCursor

Constructor Summary
IDataFactory()
           
 
Method Summary
static IData create()
          Creates a new, empty IData object.
static IData create(int size)
          Returns an IData object containing the specified number of key/value pairs.
static IData create(java.lang.Object[][] values)
          Creates an IData object and initializes its key/value pairs from the contents of a specified two-column array, where the first column of the array contains key names and the second column contains the values of those keys.
static IData create(java.lang.String name)
          Returns an IData object created from a specified class.
static void register(java.lang.String name, java.lang.String className)
          Registers a concrete IData class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDataFactory

public IDataFactory()
Method Detail

create

public static final IData create()
Creates a new, empty IData object.

Returns:
A new, empty IData object.

create

public static final IData create(int size)
Returns an IData object containing the specified number of key/value pairs.

Parameters:
size - an int specifying the capacity of the IData object in key/value pairs.
Returns:
An IData object of the specified size.

create

public static final IData create(java.lang.Object[][] values)
Creates an IData object and initializes its key/value pairs from the contents of a specified two-column array, where the first column of the array contains key names and the second column contains the values of those keys. The first column of the array (the one that specifies key names) must contain only String values representing key names. Anything other than a String in this column will cause a ClassCastException to occur at run time. If any member of the second column (the one that specifies values) of the array is null, the element is not included in the IData object (this is done for performance reasons). If you want to include null values in the IData object, use the create method in com.wm.data.IDataUtil instead.

Parameters:
values - A two-column array in the form x[key][value], where the first column of the array is a String that specifies a key name and the second column is an Object containing the value associated with the key. The array can have an unlimited number of rows.
Returns:
An IData object containing the key/value pairs defined by the values [][] array.
See Also:
IDataUtil.create(Object[][])

create

public static final IData create(java.lang.String name)
                          throws java.lang.Exception
Returns an IData object created from a specified class. You can use this method to construct a customized IData object instead of the default IData object produced by this IDataFactory.

Parameters:
name - A String that specifies the name of the class from which the IData object is to be created.
Returns:
An IData object created from the specified class.
Throws:
java.lang.Exception - If the specified class does not exist.

register

public static final void register(java.lang.String name,
                                  java.lang.String className)
                           throws java.lang.Exception
Registers a concrete IData class. This allows you to implement a custom IData class and register it with the IDataFactory, so that it can be constructed with the create(String name) method.

Parameters:
name - A String that specifies the name under which you want to register your class. Note that this name will be used as the key for this class in this IDataFactory objects table of registered implementations.
className - A String that specifies the Java generated name of this class.
Throws:
throws - exception if name is already registered.
java.lang.Exception