LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2024] EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

CONTACT

Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.

Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.

NAME

Bio::EnsEMBL::Storable

SYNOPSIS

my $dbID    = $storable_object->dbID();
my $adaptor = $storable_object->adaptor();
if ( $storable_object->is_stored($db_adaptor) ) { ... }

DESCRIPTION

This is a storable base class. All objects which are storable in the database should inherit from this class. It provides two getter/setters: dbID() adaptor(). And a is_stored() method that can be used to determine if an object is already stored in a database.

new

Arg [-ADAPTOR] : Bio::EnsEMBL::DBSQL::BaseAdaptor
Arg [-dbID]    : database internal id
Caller         : internal calls
Description    : create a new Storable object 
Returntype     : Bio::EnsEMBL::Storable
Exceptions     : Adaptor not a Bio::EnsEMBL::DBSQL::BaseAdaptor
Status         : Stable

new_fast

Arg [1]    : hashref to be blessed
Description: Construct a new Bio::EnsEMBL::Storable object using the hashref.
             This is a very quick constructor that requires internal knowledge 
             of the class. This is used in speed critical sections of the code
             where many objects need to be created quickly.
Exceptions : none
Returntype : Instance of Bio::EnsEMBL::Storable subclass
Caller     : general, subclass constructors
Status     : Stable

dbID

Arg [1]    : int $dbID
Description: getter/setter for the database internal id
Returntype : int
Exceptions : none
Caller     : general, set from adaptor on store
Status     : Stable

adaptor

Arg [1]    : Bio::EnsEMBL::DBSQL::BaseAdaptor $adaptor
Description: get/set for this objects Adaptor
Returntype : Bio::EnsEMBL::DBSQL::BaseAdaptor
Exceptions : none
Caller     : general, set from adaptor on store
Status     : Stable

is_stored

Arg [1]    : Bio::EnsEMBL::DBSQL::DBConnection 
           : or Bio::EnsEMBL::DBSQL::DBAdaptor
Example    : do_something if($object->is_stored($db));
Description: Returns true if this object is stored in the provided database.
             This works under the assumption that if the adaptor and dbID are
             set and the database of the adaptor shares the port, dbname and
             hostname with the provided database, this object is stored in
             that database.
Returntype : 1 or 0
Exceptions : throw if dbID is set but adaptor is not
             throw if adaptor is set but dbID is not
             throw if incorrect argument is passed
Caller     : store methods
Status     : Stable