com.arsdigita.persistence.metadata
Class ObjectType

java.lang.Object
  extended bycom.arsdigita.persistence.metadata.Element
      extended bycom.arsdigita.persistence.metadata.ModelElement
          extended bycom.arsdigita.persistence.metadata.DataType
              extended bycom.arsdigita.persistence.metadata.CompoundType
                  extended bycom.arsdigita.persistence.metadata.ObjectType

public class ObjectType
extends CompoundType

The ObjectType class is a specialized form of CompoundType that supports inheritence. It also adds the notion of identity by allowing properties to be marked as special "key" properties.

Version:
$Revision: #18 $ $Date: 2004/04/07 $
Author:
rhs@mit.edu

Field Summary
static String versionId
           
 
Method Summary
 ObjectType getBasetype()
          Returns the base type of this ObjectType (which may simply be the current ObjectType).
 Iterator getDeclaredProperties()
          Returns an Iterator containing all the properties that are defined by this ObjectType directly.
 Property getDeclaredProperty(String name)
          Returns the Property directly defined by this ObjectType with the given name or null if no such property exists.
 Iterator getKeyProperties()
          Returns an Iterator containing all the properties that are part of this ObjectType's key.
 Iterator getProperties()
          Returns an Iterator containing all the properties that are part of this ObjectType.
 Property getProperty(String name)
          Returns the Property contained by this ObjectType with the given name or null if no such property exists.
 ObjectType getSupertype()
          Returns the supertype of this ObjectType or null if this is a base type.
 boolean hasDeclaredProperty(String name)
          Returns true if this ObjectType directly defines a Property with the given name.
 boolean hasProperty(String name)
          Returns true if this ObjectType contains a Property with the given name.
 boolean isKeyProperty(Property p)
          Returns true if the given Property is one of the key Properties on this ObjectType.
 boolean isKeyProperty(String name)
          Returns true if the given Property name belongs to this Object type, and is one of the key Properties.
 boolean isSubtypeOf(ObjectType type)
          Returns true if this ObjectType is a subtype of type.
 boolean isSubtypeOf(String qualifiedName)
           
static void verifySubtype(ObjectType baseType, ObjectType extendedType)
          Checks if the ObjectType specified by extendedType is a subtype of the ObjectType specified by baseType.
static void verifySubtype(ObjectType baseType, String extendedType)
           
static void verifySubtype(String baseType, ObjectType extendedType)
           
static void verifySubtype(String baseType, String extendedType)
           
 
Methods inherited from class com.arsdigita.persistence.metadata.CompoundType
isCompound
 
Methods inherited from class com.arsdigita.persistence.metadata.DataType
getName, getQualifiedName, isSimple
 
Methods inherited from class com.arsdigita.persistence.metadata.ModelElement
getModel
 
Methods inherited from class com.arsdigita.persistence.metadata.Element
equals, getColumnNumber, getFilename, getLineNumber, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Method Detail

getSupertype

public ObjectType getSupertype()
Returns the supertype of this ObjectType or null if this is a base type.

Returns:
The supertype of this ObjectType or null if this is a base.

getBasetype

public ObjectType getBasetype()
Returns the base type of this ObjectType (which may simply be the current ObjectType).

Returns:
The base type of this ObjectType.

isKeyProperty

public boolean isKeyProperty(Property p)
Returns true if the given Property is one of the key Properties on this ObjectType.

Parameters:
p - The property to check.
Returns:
true if is a key property.

isKeyProperty

public boolean isKeyProperty(String name)
Returns true if the given Property name belongs to this Object type, and is one of the key Properties.

Parameters:
name - The name of a property to check.
Returns:
true if is a key property.

getKeyProperties

public Iterator getKeyProperties()
Returns an Iterator containing all the properties that are part of this ObjectType's key.

Returns:
An Iterator containing instances of the Property class.
See Also:
Property

getProperties

public Iterator getProperties()
Returns an Iterator containing all the properties that are part of this ObjectType. This includes any properties defined in this ObjectType's supertype.

Specified by:
getProperties in class CompoundType
Returns:
An Iterator containing instances of the Property class.
See Also:
Property

getDeclaredProperties

public Iterator getDeclaredProperties()
Returns an Iterator containing all the properties that are defined by this ObjectType directly. This does not include any properties that are defined in this ObjectType's supertype.

Returns:
An Iterator contianing instances of the Property class.
See Also:
Property

hasProperty

public boolean hasProperty(String name)
Returns true if this ObjectType contains a Property with the given name. This includes any Properties inherited from the supertype.

Specified by:
hasProperty in class CompoundType
Parameters:
name - The name of the property to query for.
Returns:
True if this ObjectType contains a Property with the given name, false otherwise.

hasDeclaredProperty

public boolean hasDeclaredProperty(String name)
Returns true if this ObjectType directly defines a Property with the given name. This does not any Properties inherited from the supertype.

Parameters:
name - The name of the property to query for.
Returns:
True if this ObjectType contains a directly defined Property with the given name, false otherwise.

getProperty

public Property getProperty(String name)
Returns the Property contained by this ObjectType with the given name or null if no such property exists. This includes any properties that may be defined by the supertype.

Specified by:
getProperty in class CompoundType
Parameters:
name - The name of the property to retrieve.
Returns:
An instance of Property or null.

getDeclaredProperty

public Property getDeclaredProperty(String name)
Returns the Property directly defined by this ObjectType with the given name or null if no such property exists. This does not include any properties that may be defined by the supertype.

Parameters:
name - The name of the property to retrieve.
Returns:
An instance of Property or null.

isSubtypeOf

public boolean isSubtypeOf(String qualifiedName)
See Also:
isSubtypeOf(ObjectType)

isSubtypeOf

public boolean isSubtypeOf(ObjectType type)
Returns true if this ObjectType is a subtype of type. The definition of the subtype relation is that A is a subtype of B if and only if anywhere in code that B appears, A can appear as well and the code will still function. This means that an object type is a subtype of itself.

Parameters:
type - The candidate supertype.
Returns:
True if this ObjectType is a subtype of type.

verifySubtype

public static void verifySubtype(ObjectType baseType,
                                 ObjectType extendedType)
Checks if the ObjectType specified by extendedType is a subtype of the ObjectType specified by baseType.

Parameters:
baseType - The base object type.
extendedType - The extended object type.
Throws:
PersistenceException - Thrown if extendedType is not a subtype of the ObjectType specified by baseType.

verifySubtype

public static void verifySubtype(String baseType,
                                 String extendedType)

verifySubtype

public static void verifySubtype(String baseType,
                                 ObjectType extendedType)

verifySubtype

public static void verifySubtype(ObjectType baseType,
                                 String extendedType)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC