NAME

InterMine::Model::ClassDescriptor - represents a class in an InterMine model

SYNOPSIS

use InterMine::Model::ClassDescriptor;

...
my $cd =
  new InterMine::Model::ClassDescriptor(model => $model,
                                        name => "Gene", extends => ["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.

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.

FUNCTIONS

new

Usage   : my $cd = new InterMine::Model::ClassDescriptor(model => $model,
                            name => "Gene", 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

add_field

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

name

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

parents

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

Usage   : @parent_cds = $cd->parental_class_descriptors();
Function: return a list of the ClassDescriptor objects for the
          classes/interfaces that this class directly extends
Args    : none

fields

Usage   : @fields = $cd->fields();
Function: Return the Attribute, Reference and Collection objects for all the
          fields of this class
Args    : none

get_field_by_name

Usage   : $field = $cd->get_field_by_name('company');
Function: Return a Field object describing the given field, not undef if the
          field isn't a field in this class
Args    : $field_name - the name of the field to find

valid_field

Usage   : if ($cd->valid_field('company')) { ... }
Function: Return true if and only if the named field is a field in this class
Args    : $field_name - the name of the field to find

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