[Biojava-dev] AbstractSequence private access

PATERSON Trevor trevor.paterson at roslin.ed.ac.uk
Wed Oct 13 10:42:40 UTC 2010


Hi

you may recall that many months ago I was attempting to use BioJava3 objects in our Java EnsemblAPI project http://jensembl.sourceforge.net/

I have just been looking at how your recent code updates affect our demo

our original basic problem was that

1. we need to subclass DNASequence (which subclasses Abstract Sequence)
2. we need to be able to set the ProxySequenceReader ***after*** we have made a subclassed DNASequence Object

there are various very clunky workarounds we could do for this - either by using reflection to set the ProxySequenceReader
or replacing existing DNASequence Objects with  a new DNASequence Object constructed with a ProxySequenceReader  as we need to

however the clean fix I hacked into a previous version of your code was to change the modifier in AbsractSequence from

private SequenceReader<C> sequenceStorage;

to

protected SequenceReader<C> sequenceStorage;

so that I could then use Subclasses as a bean rather than immutable object

I don't think that our use case is particularly unreasonable - because I can easily imagine scenarios where you might want to
change the Datasource for a DNASequence object on the fly - which could be done by resetting its reader.

Is there any reason why the sequenceStorage field must be private rather than protected?

(And without any in depth knowledge of BioJava, is this design pattern widespread, because it has implications for any occasion
where Objects are populated by lazy load from datasources)


cheers

trevor

ps good to see that biojava3 is coming to fruition after all your hard work




Trevor Paterson PhD
new email trevor.paterson at roslin.ed.ac.uk<mailto:trevor.paterson at roslin.ed.ac.uk>

Bioinformatics
The Roslin Institute
The Royal (Dick) School of Veterinary Studies
University of Edinburgh
Scotland EH25 9PS
phone +44 (0)131 5274197
http://bioinformatics.roslin.ed.ac.uk/

Please consider the environment before printing this e-mail

The University of Edinburgh is a charitable body, registered in Scotland with registration number SC005336
Disclaimer:This e-mail and any attachments are confidential and intended solely for the use of the recipient(s) to whom they are addressed. If you have received it in error, please destroy all copies and inform the sender.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <http://lists.open-bio.org/pipermail/biojava-dev/attachments/20101013/a45b911e/attachment-0001.ksh>


More information about the biojava-dev mailing list