Class Type

A Class org.favabeans.base.TypeType object is an analogue of a Java class; it allows us to categorize objects, but provides for more fine-grained control over this categorization than would be possible were we to categorize objects based on their Java class alone. See Figure 3.1 for more details; the additional classes shown in this class diagram are discussed below.

Figure 3.1. Class Class org.favabeans.base.TypeType.

Class Class org.favabeans.base.TypeType implements Interface org.favabeans.util.PoComparablePoComparable, allowing us to use it in partially ordered data structures.

We have made the simplifying design decision that the Class org.favabeans.base.TypeType of an object does not change at run-time. Without this simplification, the state machine for the objects in our framework would be complicated by having to handle "type changed" events.

Important

We may relax the requirement that the Type of an object not change at run-time later on.

Notably absent from the contract of class Class org.favabeans.base.TypeType is any notion of uniqueness of the of the Class org.favabeans.base.TypeType of a given object. On the other hand, any subsystem responsible for returning the Class org.favabeans.base.TypeType of an object can and should return at least the appropriate Class org.favabeans.base.JavaTypeJavaType (see below); effectively, this is a guarantee that there exists a minimum of one Class org.favabeans.base.TypeType for any Class java.lang.ObjectObject.

A developer could, if they so wished, define subclasses of Class org.favabeans.base.TypeType which recognize information that is not necessarily representable by an Class java.lang.ObjectObject; the most obvious example would be a Class org.favabeans.base.TypeType associated with a Java primitive data type such as integer. We neither recommend nor discourage this approach, but we note that such a Class org.favabeans.base.TypeType may not be very useful, as it would be unable to recognize instances of itself via the Method org.favabeans.base.Type.isInstance(java.lang.Object)Type.isInstance(Object) method.