[Biojava-l] proposal: application subclassing of biosql objects
mark.schreiber at novartis.com
mark.schreiber at novartis.com
Thu Jun 22 00:44:18 UTC 2006
OK with this too.
David Scott <david at autohandle.com>
Sent by: biojava-l-bounces at lists.open-bio.org
06/21/2006 11:50 PM
To: biojava-l at lists.open-bio.org
cc: (bcc: Mark Schreiber/GP/Novartis)
Subject: [Biojava-l] proposal: application subclassing of biosql objects
install a static Map in RichObjectFactory that the application can use
to map application subclasses of the biosql classes contained in the
RichObjectFactory code - applications would set up the map via:
public final static void setApplicationClass(final Class
theBioJavaClass, final Class theApplicationClass)
RichObjectFactory would retrieve the Map via:
private final static class getApplicationClass(final Class
theBioJavaClass);
RichObjectFactory would substitute the application class for the biojava
class in getObject:
public static synchronized Object getObject(final Class clazz, Object[]
params) {
List paramsList = Arrays.asList(params);
final Class applicationClass = getApplicationClass(clazz);
....
.... builder.buildObject(applicationClass, paramsList);
BioSqlRichObjectBuilder would recognize the subclass in buildObject by
changing the if statements from identity:
public Object buildObject(Clazz clazz, List paramsList) {
if (clazz == SimpleNamespace.class) {
...
to assignable:
public Object buildObject(Clazz clazz, List paramsList) {
if (SimpleNamespace.class.isAssignableFrom(clazz)) {
...
the map size will be short - a linear search might be faster than a hash.
_______________________________________________
Biojava-l mailing list - Biojava-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biojava-l
More information about the Biojava-l
mailing list