Open Journal Systems  3.3.0
TypeDescriptionFactory Class Reference

Public Member Functions

 __construct ()
 
 _namespaceMap ($namespace)
 
instantiateTypeDescription ($typeDescription)
 

Static Public Member Functions

static getInstance ()
 

Detailed Description

A factory class that takes a plain text type descriptor and instantiates the correct type description object based on the descriptor's namespace.

Definition at line 24 of file TypeDescriptionFactory.inc.php.

Constructor & Destructor Documentation

◆ __construct()

TypeDescriptionFactory::__construct ( )

Constructor

NB: Should not be called directly! Always use getInstance().

Definition at line 31 of file TypeDescriptionFactory.inc.php.

Member Function Documentation

◆ _namespaceMap()

TypeDescriptionFactory::_namespaceMap (   $namespace)

Map a namespace to a fully qualified type descriptor class name.

FIXME: Move this map to the Application object.

Parameters
$namespacestring
Returns
string

Definition at line 105 of file TypeDescriptionFactory.inc.php.

Referenced by instantiateTypeDescription().

◆ getInstance()

static TypeDescriptionFactory::getInstance ( )
static

◆ instantiateTypeDescription()

& TypeDescriptionFactory::instantiateTypeDescription (   $typeDescription)

Takes a plain text type descriptor, identifies the namespace and instantiates the corresponding type description object.

Parameters
$typeDescriptionstring A plain text type description.

Type descriptions consist of two parts:

  • a type namespace
  • a type name (optionally including parameters like cardinality, etc.)

Example: primitive::string[5] -> namespace: primitive - type name: string[5]

Each namespace will be mapped to one subclass of the TypeDescription class which will then be responsible to parse the given type name.

Returns
TypeDescription or null if the type description is invalid.

Definition at line 74 of file TypeDescriptionFactory.inc.php.

References _namespaceMap(), and instantiate().


The documentation for this class was generated from the following file: