blackboard.data
Class AbstractIdentifiable

java.lang.Object
  extended by blackboard.data.AbstractIdentifiable
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
MessageTag

public abstract class AbstractIdentifiable
extends java.lang.Object
implements Identifiable

Base implementation of the Identifiable interface for POJO data objects. Subclasses of this object should declare a variable of type DataType that is public static final and called "DATA_TYPE" in order for the local implementation of getDataType() to properly function.

Since:
Bb 7.2
Version:
$Revision: #1 $ $Date: 2007/06/27 $

Constructor Summary
AbstractIdentifiable()
           
 
Method Summary
 DataType getDataType()
          Returns the DataType identifier for this data object. Since it is not possible for this implementation of getDataType to know the DataType of a subclass, this method uses reflection to dynamically look up a property named "DATA_TYPE".
 Id getId()
          Returns the Id associated with this Identifiable object.
 void setId(Id id)
          Sets the Id value for this Identifiable object.
 java.lang.String toString()
          Returns the contents of this object as a line-feed separated list of name/ value pairs of this object's properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractIdentifiable

public AbstractIdentifiable()
Method Detail

getId

public Id getId()
Returns the Id associated with this Identifiable object.

Specified by:
getId in interface Identifiable
Returns:
Id value for this Identifiable object

setId

public void setId(Id id)
Sets the Id value for this Identifiable object.

Specified by:
setId in interface Identifiable
Parameters:
id - an Id value to use for this Identifiable object

getDataType

public DataType getDataType()
                     throws java.lang.RuntimeException
Returns the DataType identifier for this data object. Can be used to uniquely identify the "type" of a data object.

Since it is not possible for this implementation of getDataType to know the DataType of a subclass, this method uses reflection to dynamically look up a property named "DATA_TYPE". As a result, any subclass must declare this property (typically declared as public static final DataType in order for this method to run successfully.

Specified by:
getDataType in interface Identifiable
Returns:
the DataType for current object
Throws:
java.lang.RuntimeException - if it is unable to successfully determine the data type of an implementing class.

toString

public java.lang.String toString()
Returns the contents of this object as a line-feed separated list of name/ value pairs of this object's properties. The line-feed character used is the one specified by the java system property "line.separator". This method can be used for debug purposes.

This method uses bean-based property introspection to retrieve the set of properties defined on the object. This includes all properties defined up to and including the base AbstractIdentifiable class.

Overrides:
toString in class java.lang.Object
Returns:
a String that represents the properties of this object


Copyright © 2003 Blackboard, Inc. All Rights Reserved.