org.favabeans.base
Class Type

java.lang.Object
  |
  +--java.awt.datatransfer.DataFlavor
        |
        +--org.favabeans.base.Type
All Implemented Interfaces:
Cloneable, Externalizable, PoComparable, Serializable
Direct Known Subclasses:
DataSourceType, HasFacetType, JavaType

public abstract class Type
extends DataFlavor
implements PoComparable, Serializable

A Type object is an analogue of a Java class. However, implementations can use any algorithm for determining whether a given Java object is "an instance of" this Type.

Instances of Type form a bridge between the java.awt.datatransfer interfaces and the internal workings of FavaBeans.

Types generalize the Java class system, and are intended to be flexible enough to categorize objects arbitrarily, according to their content, so that the UI can make intelligent choices about how -- or even whether -- to present a specific object to the user.

See Also:
Serialized Form

Fields inherited from class java.awt.datatransfer.DataFlavor
javaFileListFlavor, javaJVMLocalObjectMimeType, javaRemoteObjectMimeType, javaSerializedObjectMimeType, plainTextFlavor, stringFlavor
 
Constructor Summary
protected Type()
           
 
Method Summary
 boolean equals(DataFlavor t)
          Determine if this object is equal to some other Type object.
 boolean equals(Object o)
          Determine if an object is equal to this one.
 String getMimeType()
           
static Type getType(Object o)
          Obtain a unique Type that matches a given object.
 boolean greaterThan(Object t)
          Determine if this object is greater than some other Type object.
 boolean isAssignableFrom(Type t)
          Determine whether the specified Type is a subtype of, or equal to, this Type.
abstract  boolean isInstance(Object object)
          Determine if a given arbitrary Java object is an instance of this Type.
abstract  boolean isStrictSubtypeOf(Type t)
          Determine whether this Type is a strict subtype of another Type t.
 boolean lessThan(Object t)
          Determine if this object is less than some other Type object.
 
Methods inherited from class java.awt.datatransfer.DataFlavor
clone, equals, getDefaultRepresentationClass, getDefaultRepresentationClassAsString, getHumanPresentableName, getParameter, getPrimaryType, getReaderForText, getRepresentationClass, getSubType, getTextPlainUnicodeFlavor, hashCode, isFlavorJavaFileListType, isFlavorRemoteObjectType, isFlavorSerializedObjectType, isMimeTypeEqual, isMimeTypeEqual, isMimeTypeSerializedObject, isRepresentationClassInputStream, isRepresentationClassRemote, isRepresentationClassSerializable, match, normalizeMimeType, normalizeMimeTypeParameter, readExternal, selectBestTextFlavor, setHumanPresentableName, toString, tryToLoadClass, writeExternal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Type

protected Type()
Method Detail

getMimeType

public String getMimeType()
Overrides:
getMimeType in class DataFlavor
Returns:
DataFlavor.javaJVMLocalObjectMimeType, always.

isStrictSubtypeOf

public abstract boolean isStrictSubtypeOf(Type t)
Determine whether this Type is a strict subtype of another Type t. By strict subtype, we mean that this Type is a subtype of t, but not equal to t.
Parameters:
type - the specified Type
Returns:
true if this object is a strict subtype of t; false otherwise.

isAssignableFrom

public boolean isAssignableFrom(Type t)
Determine whether the specified Type is a subtype of, or equal to, this Type.
Parameters:
t - the specified Type
Returns:
true if type is a subtype of, or equals(), this; false otherwise.
See Also:
Class.isAssignableFrom(java.lang.Class)

isInstance

public abstract boolean isInstance(Object object)
Determine if a given arbitrary Java object is an instance of this Type.
Parameters:
object - an arbitrary Java object reference.
Returns:
true if object is considered "an instance of this Type"; false otherwise.
See Also:
Class.isInstance(java.lang.Object)

greaterThan

public boolean greaterThan(Object t)
Determine if this object is greater than some other Type object. By definition, a Type p is greater than a Type q if p.isAssignableFrom(q).
Specified by:
greaterThan in interface PoComparable
Parameters:
t - another object, perhaps another Type.
Returns:
true if t is a Type and this object is greater than t.

lessThan

public boolean lessThan(Object t)
Determine if this object is less than some other Type object. By definition, a Type t is less than a Type q if q.isAssignableFrom(t).
Specified by:
lessThan in interface PoComparable
Parameters:
t - another object, perhaps another Type.
Returns:
true if t is a Type and this object is less than t.

equals

public boolean equals(DataFlavor t)
Determine if this object is equal to some other Type object.
Overrides:
equals in class DataFlavor
Parameters:
t - another DataFlavor, perhaps another Type.
Returns:
true if t is a Type and t is equal to this.

equals

public boolean equals(Object o)
Description copied from interface: PoComparable
Determine if an object is equal to this one.
Specified by:
equals in interface PoComparable
Overrides:
equals in class DataFlavor
Following copied from interface: org.favabeans.util.PoComparable
Parameters:
x - the object to which this object will be compared.
Returns:
true if this object is equal to x; false otherwise.

getType

public static Type getType(Object o)
Obtain a unique Type that matches a given object.
Parameters:
o - the object for which to obtain the Type.
Returns:
a unique Type representing the object o.


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.