The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

name | package

return the name of the class this class descriptor represents. Package is the attribute inherited from Moose::Meta::Class

 Usage   : $name = $cd->name();
 Function: Return the name of this class, eg. "Gene"
 Args    : none

own_fields

The list of fields that were declared in this class (not inherited from elsewhere), it has the following accessors:

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. 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

parents

The immediate ancestors of this class.

 Usage   : @parent_class_names = $cd->parents();
 Function: return a list of the names of the classes/interfaces that this class
           directly extends
 Args    : none

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

ancestors

The full inheritance list, including all ancestors in the model.

add_field

 Usage   : $cd->add_field($field);
 Function: add a Field to this class
 Args    : $field - a sub class of InterMine::Model::Field

attributes

 Usage   : @fields = $cd->attributes();
 Function: Return the Attribute objects for the attributes of this class
 Args    : none

references

 Usage   : @fields = $cd->references();
 Function: Return the Reference objects for the references of this class
 Args    : none

collections

 Usage   : @fields = $cd->collections();
 Function: Return the Collection objects for the collections of this class
 Args    : none

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

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:

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.