com.ibm.dse.base.types
Class DSEType

java.lang.Object
  |
  +--com.ibm.dse.base.types.DSEType

public class DSEType
extends java.lang.Object
implements Type, TypeConstants

This class provides an implementation of the Type interface which defines a Type of business object or business process.

This definition is configured through the associated of PropertyDescriptors. Two kinds of PropertyDescriptors can be associated, namely those which describe structure and a single PropertyDescriptor which defines the default business rules for business objects of this Type.


Field Summary
static DSETypeExternalizer externalizer
           
 
Fields inherited from interface com.ibm.dse.base.types.TypeConstants
CONV_TYPE_DEFAULT, CONV_TYPE_HOST, CONV_TYPE_OUTPUT, CONV_TYPE_SER, CONV_TYPE_XML, disabled, hidden, isDisabled, isHidden, isMandatory, isOmitted, isReadOnly, mandatory, omitted, readOnly, TYPE_DEFAULT, TYPE_REGISTRY_INIT_SIZE
 
Constructor Summary
DSEType(java.lang.String name, java.lang.String implClassName)
          This constructor creates a DSEType with the name and implementing class passed as argument.
 
Method Summary
 PropertyDescription addPropertyDescriptor(PropertyDescription descriptor)
          Adds the PropertyDescriptor passed as argument to the list of contained descriptors and if successful, the PropertyDescriptor added is returned.
 java.lang.Object createInstance()
          Returns a business object populated with the default data specified for this Type.
 java.lang.Object createInstance(PropertyDescription descriptor)
          Returns a business object populated with the default data specified for this Type.
 PropertyDescription getDefaultDescriptorForType()
          Returns the PropertyDescriptor associated with this Type which defines its business rules.
static DSETypeExternalizer getExternalizer()
          Gets the externalizer.
 java.lang.Class getImplClass()
          Returns the class which implements the business behaviour described by this Type.
 Key getKey(TypedData businessObject)
          Returns a Key object which can, if the Type has unique Keys, be used to identify the business object passed as argument.
 KeyBuilder getKeyBuilder()
          Returns the KeyBuilder responsible for building Keys for this Type.
 java.lang.String getName()
          Returns the name of this Type.
 PropertyDescription getPropertyDescriptor(int index)
          Returns the PropertyDescriptor at the index passed
 PropertyDescription getPropertyDescriptor(java.lang.String name)
          Returns the PropertyDescriptor with the name passed, or null is no descriptor of that name exists.
 java.util.Enumeration getPropertyDescriptors()
          Retruns an Enumeration of all PropertyDescriptors contained within this Type.
 boolean isCompound()
          Retruns a flag indicating whether this Type is Compound or not.
static java.lang.Object readObject(java.lang.String name)
          Instantiates a Typed Data Element named: name, from the definition file.
 void reset()
          Resets this type
 void reset(Type newType)
          Resets this type with a new Type instance
 void setDefaultDescriptorForType(PropertyDescription defaultDescriptor)
          Sets the default PropertyDescriptor which defines this Types business rules to that passed as argument.
static void setExternalizer(DSETypeExternalizer anExternalizer)
          Sets the externalizer.
 void setKeyBuilder(KeyBuilder keyBuilder)
          Sets the KeyBuilder which is responsible for building Keys for this Type to that passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

externalizer

public static DSETypeExternalizer externalizer
Constructor Detail

DSEType

public DSEType(java.lang.String name,
               java.lang.String implClassName)
        throws DSETypeException
This constructor creates a DSEType with the name and implementing class passed as argument.
Parameters:
name - String
implClassName - String
Method Detail

addPropertyDescriptor

public PropertyDescription addPropertyDescriptor(PropertyDescription descriptor)
                                          throws DSETypeException
Adds the PropertyDescriptor passed as argument to the list of contained descriptors and if successful, the PropertyDescriptor added is returned.
Specified by:
addPropertyDescriptor in interface Type
Parameters:
propertyDescriptor - PropertyDescription
Returns:
PropertyDescriptor
Throws:
DSETypeException - Name of PropertyDescriptor to add is either null or a duplicate.

createInstance

public java.lang.Object createInstance()
                                throws DSETypeException
Returns a business object populated with the default data specified for this Type.

Compond Types return a KeyedCollection, Simple Types return a DataField with a business object as value. The business object returned is associated with the defualt PropertyDescriptor for this Type.

Specified by:
createInstance in interface Type
Returns:
TypedData
Throws:
DSETypeException - Object creation is unsuccessful.

createInstance

public java.lang.Object createInstance(PropertyDescription descriptor)
                                throws DSETypeException
Returns a business object populated with the default data specified for this Type.

Compond Types return a KeyedCollection, Simple Types return a DataField with a business object as value. The PropertyDescriptor to be associated with the business object created is passed as argument.

Specified by:
createInstance in interface Type
Parameters:
propertyDescriptor - PropertyDescription
Returns:
TypedData
Throws:
DSETypeException - Object creation is unsuccessful.

getDefaultDescriptorForType

public PropertyDescription getDefaultDescriptorForType()
Returns the PropertyDescriptor associated with this Type which defines its business rules.
Specified by:
getDefaultDescriptorForType in interface Type
Returns:
PropertyDescription

getExternalizer

public static DSETypeExternalizer getExternalizer()
                                           throws DSETypeException
Gets the externalizer.
Returns:
DSETypeExternalizer

getImplClass

public java.lang.Class getImplClass()
Returns the class which implements the business behaviour described by this Type.
Specified by:
getImplClass in interface Type
Returns:
Class

getKey

public Key getKey(TypedData businessObject)
           throws DSETypeException
Returns a Key object which can, if the Type has unique Keys, be used to identify the business object passed as argument.

This behaviour may be delegated to a utility object since Types are to be employed, not subclassed. Returns a Key with a value of zero for all Types, including Simple Types, which do not have unique Keys.

Specified by:
getKey in interface Type
Parameters:
businessObject - TypedData
Returns:
Key

getKeyBuilder

public KeyBuilder getKeyBuilder()
Returns the KeyBuilder responsible for building Keys for this Type.
Specified by:
getKeyBuilder in interface Type
Returns:
KeyBuilder

getName

public java.lang.String getName()
Returns the name of this Type.
Specified by:
getName in interface Type
Returns:
String

getPropertyDescriptor

public PropertyDescription getPropertyDescriptor(int index)
Returns the PropertyDescriptor at the index passed
Specified by:
getPropertyDescriptor in interface Type
Parameters:
index - int
Returns:
PropertyDescription

getPropertyDescriptor

public PropertyDescription getPropertyDescriptor(java.lang.String name)
Returns the PropertyDescriptor with the name passed, or null is no descriptor of that name exists.
Specified by:
getPropertyDescriptor in interface Type
Parameters:
name - String
Returns:
PropertyDescription

getPropertyDescriptors

public java.util.Enumeration getPropertyDescriptors()
Retruns an Enumeration of all PropertyDescriptors contained within this Type.
Specified by:
getPropertyDescriptors in interface Type
Returns:
Enumeration

isCompound

public boolean isCompound()
Retruns a flag indicating whether this Type is Compound or not.
Specified by:
isCompound in interface Type
Returns:
boolean

readObject

public static java.lang.Object readObject(java.lang.String name)
                                   throws DSETypeException
Instantiates a Typed Data Element named: name, from the definition file.
Returns:
java.lang.Object

reset

public void reset()
           throws DSETypeException
Resets this type
Specified by:
reset in interface Type
Throws:
DSETypeException - if the type cannot be reset

reset

public void reset(Type newType)
           throws DSETypeException
Resets this type with a new Type instance
Specified by:
reset in interface Type
Parameters:
newType - com.ibm.dse.base.types.DSEType
Throws:
DSETypeException - if the type cannot be reset

setDefaultDescriptorForType

public void setDefaultDescriptorForType(PropertyDescription defaultDescriptor)
Sets the default PropertyDescriptor which defines this Types business rules to that passed as argument.
Specified by:
setDefaultDescriptorForType in interface Type
Parameters:
propertyDescriptor - PropertyDescription

setExternalizer

public static void setExternalizer(DSETypeExternalizer anExternalizer)
Sets the externalizer.
Parameters:
anExternalizer - DSETypeExternalizer

setKeyBuilder

public void setKeyBuilder(KeyBuilder keyBuilder)
Sets the KeyBuilder which is responsible for building Keys for this Type to that passed.
Specified by:
setKeyBuilder in interface Type
Parameters:
keyBuilder - KeyBuilder