summaryrefslogtreecommitdiffstats
path: root/sdo-java/branches/sdo-1.1-incubating/sdo-api/src/main/java/commonj/sdo/helper/DataFactory.java
blob: 8507b83440d101a22f19093a1ab964f6908d31d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
 * <copyright>
 *
 * Service Data Objects
 * Version 2.1.0
 * Licensed Materials
 *
 * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, 
 * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., 
 * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, 
 * 2005, 2006. All rights reserved.
 *
 * </copyright>
 * 
 */

package commonj.sdo.helper;

import commonj.sdo.DataObject;
import commonj.sdo.Type;
import commonj.sdo.impl.HelperProvider;

/**
 * A Factory for creating DataObjects.  
 * The created DataObjects are not connected to any other DataObjects.
 */
public interface DataFactory
{
  /**
   * Create a DataObject of the Type specified by typeName with the given package uri.
   * @param uri The uri of the Type.
   * @param typeName The name of the Type.
   * @return the created DataObject.
   * @throws IllegalArgumentException if the uri and typeName does
   *   not correspond to a Type this factory can instantiate.
   */
  DataObject create(String uri, String typeName);
  
  /**
   * Create a DataObject supporting the given interface.
   * InterfaceClass is the interface for the DataObject's Type.
   * The DataObject created is an instance of the interfaceClass.
   * @param interfaceClass is the interface for the DataObject's Type.
   * @return the created DataObject.
   * @throws IllegalArgumentException if the instanceClass does
   *   not correspond to a Type this factory can instantiate.
   */
  DataObject create(Class interfaceClass);
  
  /**
   * Create a DataObject of the Type specified.
   * @param type The Type.
   * @return the created DataObject.
   * @throws IllegalArgumentException if the Type
   *   cannot be instantiaed by this factory.
   */
  DataObject create(Type type);
  
  /**
   * The default DataFactory.
   */
  DataFactory INSTANCE = HelperProvider.getDataFactory();
 
}