[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Wed Mar 22 07:36:41 UTC 2006


senger
Wed Mar 22 02:36:41 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes
In directory pub.open-bio.org:/tmp/cvs-serv4787/src/main/org/biomoby/shared/datatypes

Modified Files:
	MapPrimitiveDataTypes.java 
Log Message:


moby-live/Java/src/main/org/biomoby/shared/datatypes MapPrimitiveDataTypes.java,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java	2005/08/29 13:21:59	1.2
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/datatypes/MapPrimitiveDataTypes.java	2006/03/22 07:36:40	1.3
@@ -10,6 +10,8 @@
 
 import org.biomoby.shared.MobyException;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Class containing static mapping between Biomoby primitive data
@@ -51,7 +53,26 @@
     public Class getClass (String dataTypeName)
 	throws MobyException {
 	String className = (String)type2class.get (dataTypeName);
-	if (className == null) return null;
+	if (className == null) {
+
+	    // a hack: sometimes the 'dataTypeName' is wrong - it is
+	    // the last piece of a class name (e.g. text_base64)
+	    // instead of a rel data type name (e.g. text-base64) - so
+	    // I try here to find it anyway, but this will go away
+	    // when MobyObject (and all generated datatypes) return
+	    // its data ype name properly...
+	    String classNameEnding = "." + dataTypeName;
+	    for (Iterator it = type2class.entrySet().iterator(); it.hasNext(); ) {
+		Map.Entry entry = (Map.Entry)it.next();
+		String cName = (String)entry.getValue();
+		if ( cName.endsWith (classNameEnding) ) {
+		    className = cName;
+		    break;
+		}
+	    }
+	    if (className == null)
+		return null;
+	}
 	try {
 	    return Class.forName (className);
 	} catch (Exception e) {




More information about the MOBY-guts mailing list