Class DataTypeManager

Description

Responsible for keeping track of the available data type primitives (such as string, integer, etc) and creation of the appropriate classes when those data types are required. Is also responsible for mapping Primitives with their respective StorablePrimitives so that we can store them in the database.

  • author: Gabe Schine
  • version: $Id: DataTypeManager.class.php,v 1.16 2007/09/04 20:25:31 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/dataManager/DataTypeManager.class.php (line 22)


	
			
Variable Summary
Method Summary
DataTypeManager DataTypeManager ()
void addDataType (string $typeName, string $primitiveClass, string $storablePrimitiveClass, string $conversionMethod)
string getConversionMethod (string $type)
bool isObjectOfDataType (ref $object, string $type)
ref newPrimitive (string $name)
string primitiveClassForType (string $type)
ref recastAsStorablePrimitive (ref $primitive, string $type)
string storablePrimitiveClassForType (string $type)
bool typeRegistered (string $name)
Variables
mixed $_primitiveClassMapping (line 25)
mixed $_registeredTypes (line 24)
Methods
Constructor DataTypeManager (line 27)
DataTypeManager DataTypeManager ()
addDataType (line 52)

Adds a specific data type (identified by a string such as "integer") to our registry. Each data type has two classes associated with it: a Primitive and a StorablePrimitive. The former is used when setting/getting values, the latter used when talking with the database.

  • access: public
void addDataType (string $typeName, string $primitiveClass, string $storablePrimitiveClass, string $conversionMethod)
  • string $typeName: The name (such as "integer" or "boolean") of this new data type.
  • string $primitiveClass: The name of the Primitive class.
  • string $storablePrimitiveClass: The name of the StorablePrimitive class.
  • string $conversionMethod
getConversionMethod (line 191)

Answer the method to call to convert to the type specified

  • since: 6/9/06
  • access: public
string getConversionMethod (string $type)
  • string $type
getRegisteredStorablePrimitives (line 159)

Returns an array of the StorablePrimitives that we have registered.

  • return: object
  • access: public
ref getRegisteredStorablePrimitives ()
getRegisteredTypes (line 39)

Returns an array of strings that represent all of the available Primitives.

  • access: public
array getRegisteredTypes ()
isObjectOfDataType (line 172)

Takes an object and a DataType name and checks if the object is of the correct class to be an object of DataType $type.

  • access: public
bool isObjectOfDataType (ref $object, string $type)
  • string $type: The type (name) of the registered DataType to check against.
  • ref $object: object The Primitive object to check.
newPrimitive (line 79)

Creates a new Primitive object that is associated with the type registered under $name.

  • return: object
  • access: public
ref newPrimitive (string $name)
  • string $name
primitiveClassForType (line 97)

Returns the primitive class that is associated with the given $type.

  • access: public
string primitiveClassForType (string $type)
  • string $type
recastAsStorablePrimitive (line 135)

Recasts a SObject to its associated StorablePrimitive class and returns the new object.

  • return: object
  • access: public
ref recastAsStorablePrimitive (ref $primitive, string $type)
  • string $type: The type of data contained in the primitive (ie, "integer" or "string")
  • ref $primitive: object $primitive
storablePrimitiveClassForType (line 115)

Returns the storable-primitive class that is associated with the given $name.

  • access: public
string storablePrimitiveClassForType (string $type)
  • string $type: The type-string of the primitive (such as "integer").
typeRegistered (line 69)

Check if we have a datatype registered under $name.

  • access: public
bool typeRegistered (string $name)
  • string $name

Documentation generated on Wed, 19 Sep 2007 10:22:31 -0400 by phpDocumentor 1.3.0RC3