KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > commonj > sdo > Type


1 /**
2  * <copyright>
3  *
4  * Service Data Objects
5  * Version 1.0
6  * Licensed Materials - Property of BEA and IBM
7  *
8  * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2003. All rights reserved.
9  *
10  * </copyright>
11  *
12  * $Id: Type.java,v 1.1 2004/03/26 15:24:15 marcelop Exp $
13  */

14 package commonj.sdo;
15
16 import java.util.List JavaDoc;
17
18 /**
19  * A representation of the type of a {@link Property property} of a {@link DataObject data object}.
20  */

21 public interface Type
22 {
23   /**
24    * Returns the name of the type.
25    * @return the type name.
26    */

27   String JavaDoc getName();
28   
29   /**
30    * Returns the namespace URI of the type.
31    * @return the namespace URI.
32    */

33   String JavaDoc getURI();
34
35   /**
36    * Returns the Java class that this type represents.
37    * @return the Java class.
38    */

39   Class JavaDoc getInstanceClass();
40
41   /**
42    * Returns whether the specified object is an instance of this type.
43    * @param object the object in question.
44    * @return <code>true</code> if the object is an instance.
45    * @see Class#isInstance
46    */

47   boolean isInstance(Object JavaDoc object);
48
49   /**
50    * Returns the list of the {@link Property properties} of this type.
51    * <p>
52    * The expression
53    *<pre>
54    * type.getProperties().indexOf(property)
55    *</pre>
56    * yields the property's index relative to this type.
57    * As such, these expressions are equivalent:
58    *<pre>
59    * dataObject.{@link DataObject#get(int) get}(i)
60    * dataObject.{@link DataObject#get(Property) get}((Property)dataObject.getType().getProperties().get(i));
61    *</pre>
62    * </p>
63    * @return the properties of the type.
64    * @see Property#getContainingType
65    */

66   List JavaDoc /*Property*/ getProperties();
67   
68   /**
69    * Returns from {@link #getProperties all the properties} of this type, the one with the specified name.
70    * As such, these expressions are equivalent:
71    *<pre>
72    * dataObject.{@link DataObject#get(String) get}("name")
73    * dataObject.{@link DataObject#get(Property) get}(dataObject.getType().getProperty("name"))
74    *</pre>
75    * </p>
76    * @return the property with the specified name.
77    * @see #getProperties
78    */

79   Property getProperty(String JavaDoc propertyName);
80 }
81
Popular Tags