UMMF::Core::Builder - Constructs a Model from an input stream.
use UMMF::Core::Factory; use UMMF::Core::Builder; my $factory = UMMF::Core::Factory->new(...); my $builder = UMMF::Core::Builder->new('factory' => $factory); my $parser = SomeModelParser->new(...); $parser->parse($builder);
Typically a model parser constructs one of these for handling parsing events.
This class manages creation of Models by managing scoping contexts for Model and Namespace during parsing of a meta-model or model description.
Once all the objects are created, the links between the ModelElements are finalized.
UMMF::UML::Import::MetaMetaModel uses this class during parsing of the UML meta-model specificiation file.
Kurt Stephens, firstname.lastname@example.org 2003/04/14
$Revision: 1.23 $
$self->begin_Model($meta, \%attr, \%opts);
Begins a new Model in the current Namespace.
Model is a Namespace, so a new Namespace context is started.
If a Model has not been created yet $self->model_top_level is set to the new Model.
my $model = $self->end_Model();
Terminates the current Model context, and resumes the previous Model and Namespace context.
my $model = $self->model;
Returns the current Model.
my $model = $self->model_top_level;
Returns the top-level Model, i.e. the first Model created by $self->begin_Model().
my $pkg = $self->begin_Package(\%attr, \%opts);
Creates a new Package and begins a new Namespace context using the new Package.
my $pkg = $self->end_Package();
Terminates the current Package context, and resumes the previous Namespace context.
Added Usage Dependencies for the current Namespace.
Each @ns is a fully-qualified ModelElement name.
Begins a new Generalization parent context.
Classifiers created within this new Generalization parent context will specialize each of the @model_element by name, by default; i.e. no generalization parents are specified in the messages to $self->begin_Classifier().
This allows a short-hand notation for causing all Classifiers in a group to speciailize a set of other Classifiers.
Restores the previous Generalization parent context.
my $cls = $self->begin_Classifier($name, $meta, $gens);
Creates a new Classifier and begins a new Namespace context using the new Classifier.
$meta defaults to
$gens defaults to the current Generalization_parent context.
Terminates the current Classifier context, and resumes the previous Namespace context.
If $opts is true, this quickly creates an empty Classifier before hand.
my $x = add_Attribute($meta, \%attr, \%opts);
Adds a new Attribute to the current Classifier.
%attr should have the same structure as an Attribute object would have.
$self->add_Literal($meta, $attr, $opts);
Adds a new Literal to the current Classifier, which must be an Enumeration.
my $x = add_Association($meta, \%attr, \%opts);
Adds a new Association between two or more participant Classifiers.
%attr should have the same structure as an Association object.
If an AssociationEnd's participant is '.' the current Namespace is used.
Each AssociationEnd's targetScope defaults to 'instance'.
Participant resolution is elided until
my $x = add_Reference($meta, \%attr, \%opts);
Adds a new Reference between a Classifer and an AssociationEnd.
%attr should have the same structure as an Reference object.
Resolution is elided until
my $ns = $self->begin_Namespace($ns);
Begins a new Namespace context.
my $ns = $self->end_Namespace();
Returns current namespace after restoring previous Namespace context.
my $obj = $self->create($name, @args);
Requests a new object of the $name type from the factory.
Subclasses can intercept all object creation here.
Notifies the factory that all objects of the $name type have been created and can be vivified.
UMMF::Boot::Factory uses this notification to do magic finalizations of the constructed Model. This is only used for the initial bootstrapping of UMMF.
Completes constrution of the Model by completing the Usages, Generalizations, Attributes and Associations created so far.