Compoze Software, Inc.

com.compoze.collab
Class ItemClass

java.lang.Object
  |
  +--com.compoze.collab.ItemClass
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ContainerClass

public class ItemClass
extends java.lang.Object
implements java.io.Serializable

Defines the class of an Item including its name, default keys, implementing Java class, containing item class and parent item class. Defines how to create a class of Item instance.

See Also:
Serialized Form

Field Summary
protected  Key[] m_defaultKeys
           
protected  java.lang.Class m_javaClass
           
protected  java.lang.String m_sContainingItemClass
           
protected  java.lang.String m_sInternalName
           
protected  java.lang.String m_sItemClassParent
           
 
Method Summary
protected static boolean checkForDuplicates(Key[] defaultKeys)
          Check for duplicates in the defaultKeys array
static ItemClass create(java.lang.String sInternalName, Key[] defaultKeys, java.lang.Class javaClass, java.lang.String sContainingItemClass, java.lang.String sItemClassParent)
          Creates an ItemClass, given its name and properties, or returns an existing ItemClass if one has already been created with the same name and properties.
 boolean equals(java.lang.Object obj)
          Equals.
 java.lang.String getContainingItemClass()
          Get the internal name of the ItemClass of containers of this ItemClass.
 Key[] getDefaultKeys()
          Gets the Keys for the properties that are available for a specific Item.
 java.lang.String getInternalName()
          Get the ItemClass's name.
 java.lang.String getItemClassParent()
          Gets the internal name of the parent ItemClass that this ItemClass extends.
 java.lang.Class getJavaClass()
          Gets the implementation class for the item class.
 Key[] getMinimumKeys()
          Gets the minimum set of keys for this class.
 int hashCode()
          Gets the hash code of the item class (the hash of its internal name).
 boolean isDefaultKey(Key key)
          Determines if the specified key is a default for the item.
 boolean isInstanceOf(ItemClass itemClass)
          Checks to see if this ItemClass is the same as or a subclass of the given ItemClass.
static ItemClass lookupItemClass(java.lang.String sInternalName)
          Find the ItemClass instance for the internal name.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_sInternalName

protected java.lang.String m_sInternalName

m_defaultKeys

protected Key[] m_defaultKeys

m_javaClass

protected java.lang.Class m_javaClass

m_sContainingItemClass

protected java.lang.String m_sContainingItemClass

m_sItemClassParent

protected java.lang.String m_sItemClassParent
Method Detail

create

public static ItemClass create(java.lang.String sInternalName,
                               Key[] defaultKeys,
                               java.lang.Class javaClass,
                               java.lang.String sContainingItemClass,
                               java.lang.String sItemClassParent)
                        throws CollaborationException
Creates an ItemClass, given its name and properties, or returns an existing ItemClass if one has already been created with the same name and properties.
Parameters:
sInternalName - unique internal name for this class (not null)
defaultKeys - array of class specific default keys; null means none
javaClass - Java class representing this class; must implement IItem (not null)
sContainingItemClass - the internal name of the item class of containers of this item (may be null if the item has no logical container, such as a root container)
sItemClassParent - the internal name of the parent item class that this item class extends.
Throws:
CollaborationException - if sInternalName or javaClass is null, if sInternalName is already used for a different class, or javaClass does not implement IItem.

checkForDuplicates

protected static boolean checkForDuplicates(Key[] defaultKeys)
Check for duplicates in the defaultKeys array
Parameters:
defaultKeys - the default Key array
Returns:
true if there are any duplicates

getDefaultKeys

public Key[] getDefaultKeys()
Gets the Keys for the properties that are available for a specific Item.
Returns:
an array containing the default keys. If no default keys, returns Key[0], never null.

getMinimumKeys

public Key[] getMinimumKeys()
Gets the minimum set of keys for this class.
Returns:
an array containing the minimum keys

isDefaultKey

public boolean isDefaultKey(Key key)
Determines if the specified key is a default for the item.
Parameters:
key - the key (must not be null)
Returns:
true if the key is a default key

getInternalName

public java.lang.String getInternalName()
Get the ItemClass's name.
Returns:
the internal name

getJavaClass

public java.lang.Class getJavaClass()
Gets the implementation class for the item class.

lookupItemClass

public static ItemClass lookupItemClass(java.lang.String sInternalName)
Find the ItemClass instance for the internal name.
Parameters:
sInternalName - internal name to look up
Returns:
corresponding ItemClass instance; null if none exists

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the string
See Also:
Object.toString()

getContainingItemClass

public java.lang.String getContainingItemClass()
Get the internal name of the ItemClass of containers of this ItemClass.
Returns:
the ContainingItemClass.

isInstanceOf

public boolean isInstanceOf(ItemClass itemClass)
Checks to see if this ItemClass is the same as or a subclass of the given ItemClass.
Parameters:
itemClass - the ItemClass to check (not null)
Returns:
true if itemClass is the same or a subclass of this class

getItemClassParent

public java.lang.String getItemClassParent()
Gets the internal name of the parent ItemClass that this ItemClass extends.
Returns:
the internal name of the item class that is the parent of this item's item class.

hashCode

public int hashCode()
Gets the hash code of the item class (the hash of its internal name).
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

equals

public boolean equals(java.lang.Object obj)
Equals. Compares using the internal name.
Overrides:
equals in class java.lang.Object
Returns:
true if the specified object is an ItemClass instance with the same internal name

Compoze Software, Inc.

Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.