NAME

UMMF::Core::Factory - Defines a factory for model construction.

SYNOPSIS

use UMMF::Core::Factory;
$factory = UMMF::Core::Factory->new('classMap' => ...,
                                           );
$factory->create('SomeClassName', ...);
$factory->createInstance('SomeClassName', ...);

DESCRIPTION

USAGE

EXPORT

None exported.

AUTHOR

Kurt Stephens, kstephens@users.sourceforge.net 2003/04/06

SEE ALSO

UMMF::Core::MetaModel

VERSION

$Revision: 1.14 $

METHODS

classMap

my $map = $self->classMap;

Returns a hash that maps names to Perl package names.

If $self->{'classMap'} is a SCALAR, $self->{'classMap'} = $self->{'classMap'}->factory_map is performed, loading the class map from a package's factory_map method..

If $self->{'classMap'} is an ARRAY, the ARRAY is transformed into a hash. In this case, colliding $names will have concatenated package names that should cause $self->class($name) to fail.

class

my $pkg = $self->class($name, @args);

Returns the Perl package for the Classifier named $name.

The Perl package is dynamically loaded, if necessary.

Called by create and create_instance.

create_instance

my $obj = $self->create_instance($name, @args);

Creates a new instance of the class named $name, via $pkg->__new_instance(@args).

This creates a new uninitialized object.

create

my $obj = $self->create($name, @args);

Creates a new initialized instance of the class named $name, via $pkg->new(@args).

flush

$self->flush($kind);

Called by UMMF::Core::Builder for each $kind of object created during Model construction.

Subclasses may override this method.