NAME
InterMine::Model::ClassDescriptor - represents a class in an InterMine model
SYNOPSIS
use InterMine::Model::ClassDescriptor;
...
my $cd = InterMine::Model::ClassDescriptor->create(
"Gene" => (
model => $model,
parents => ["BioEntity"]
)
);
DESCRIPTION
Objects of this class contain the metadata that describes a class in an InterMine model. Each class has a name, parent classes/interfaces and any number of attributes, references and collections.
InterMine class descriptors are sub classes of Moose::Meta::Class, and thus Class::MOP::Class. Please refer to these packages for further documentation.
CLASS METHODS
create( $name | $name, %attributes | $name, \%attributes | \%attributes )
The class constructor inherited from Moose::Meta::Class.
Usage : my $cd = InterMine::Model::ClassDescriptor->create(
"Gene" => (
model => $model,
parents => ["BioEntity"]
)
);
Function: create a new ClassDescriptor object
Args : model - the InterMine::Model that this class is a part of
name - the class name
parents - a list of the classes and interfaces that this
classes extends
In most normal use cases, the typical user should NOT need to call this method. It is used internally when parsing the model to build up the list of classes.
INSTANCE ATTRIBUTES
name | package
unqualified_name
returns the (unqualified) name of the class this class descriptor represents.
$gene_meta->unqualified_name # "Gene"
package
This is the attribute inherited from Moose::Meta::Class, and returns the full qualified class name that perl refers to the class internally as.
$gene_meta->name # InterMine::genomic::FlyMine::Gene
own_fields
Fields that belong to this class directly.
add_own_field($field)
Add a field to the list
get_own_fields
Get the full list of fields declared in this class.
fieldhash
The map of fields for this class, including inherited fields. It has the following accessors:
set_field($name, $field)
Set a field in the map
get_field_by_name($name)
Retrieve the named field.
fields
Retrieve all fields as a list
valid_field($name)
Returns true if there is a field of this name
attributes
Return the fields that are instances of InterMine::Model::Attribute. This is not to be confused with Class::MOP's get_all_attributes
.
references
Return all the fields that are instances of InterMine::Model::Reference, but not the subclass InterMine::Model::Collection.
collections
Return all the fields that are instances of InterMine::Model::Collection.
parents
The names of the immediate ancestors of this class.
parental_class_descriptors
The parents as a list of class objects.
Usage : @parent_cds = $cd->parental_class_descriptors();
Function: return a list of the ClassDescriptor objects for the
classes/interfaces that this class directly extends
Note : Calling this method retrives the parents from the model
and also sets up superclass relationships
in Moose. It should not be called until the Model is completely
parsed. It is called automatically once the model has been
parsed.
Args : none
INSTANCE METHODS
new_object
The instantiation method inherited from Moose::Meta::Class. You should not normally need to use this directly. Instead call the make_new
method in InterMine::Model.
get_ancestors
The full inheritance list, including all ancestors in the model.
add_field(FieldDescriptor $field, Bool own)
Add a field to the class. If there is already a field of the same name, it will not be added twice. Setting the boolean flag "own" marks this field as originating in this class
See also: InterMine::Model->_fix_class_descriptors
sub_class_of
Usage : if ($class_desc->sub_class_of($other_class_desc)) { ... }
Function: Returns true if and only if this class is a sub-class
of the given class or is the same class
Args : $other_class_desc - a ClassDescriptor, or name of one
to_string
The stringification of a class-descriptor. By default, it stringifies to its unqualified_name.
SEE ALSO
AUTHOR
FlyMine <support@flymine.org>
BUGS
Please report any bugs or feature requests to support@flymine.org
.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc InterMine::Model::ClassDescriptor
You can also look for information at:
FlyMine
COPYRIGHT & LICENSE
Copyright 2006,2007,2008,2009 FlyMine, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.