JAL-2808 convenience method to get attribute as String
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 2 Nov 2017 14:44:23 +0000 (14:44 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 2 Nov 2017 14:44:23 +0000 (14:44 +0000)
src/jalview/datamodel/SequenceFeature.java

index 5029da5..ffbd497 100755 (executable)
@@ -393,6 +393,23 @@ public class SequenceFeature implements FeatureLocationI
   }
 
   /**
+   * Answers the value of the specified attribute as string, or null if no such
+   * value
+   * 
+   * @param key
+   * @return
+   */
+  public String getValueAsString(String key)
+  {
+    if (otherDetails == null)
+    {
+      return null;
+    }
+    Object value = otherDetails.get(key);
+    return value == null ? null : value.toString();
+  }
+
+  /**
    * Returns a property value for the given key if known, else the specified
    * default value
    *