(JAL-986) getter for integer user preference properties
[jalview.git] / src / jalview / bin / Cache.java
index d2f400d..aa1a022 100755 (executable)
@@ -141,7 +141,8 @@ import org.biojava.dasobert.dasregistry.Das1Source;
  *  * <li>DISCOVERY_START - Boolean - controls if discovery services are queried on
  * startup (JWS1 services only)</li>
  * <li>DISCOVERY_URLS - comma separated list of Discovery Service endpoints. (JWS1 services only)</li>
- * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2 services in the desktop GUI
+ * <li>SHOW_JWS1_SERVICES (true) enable or disable the original Jalview 2 services in the desktop GUI</li>
+ * <li>ENABLE_RSBS_EDITOR (false for 2.7 release) enable or disable RSBS editing panel in web service preferences</li> 
  * </ul>
  * @author $author$
  * @version $Revision$
@@ -801,4 +802,24 @@ public class Cache
     }
     return null;
   }
+
+  /**
+   * get and parse a property as an integer. send any parsing problems to System.err
+   * @param property
+   * @return null or Integer
+   */
+  public static Integer getIntegerProperty(String property)
+  {
+    String val=getProperty(property);
+    if (val!=null && (val=val.trim()).length()>0)
+    {
+      try {
+        return Integer.valueOf(val);
+      } catch (NumberFormatException x)
+      {
+        System.err.println("Invalid integer in property '"+property+"' (value was '"+val+"')");
+      }
+    }
+    return null;
+  }
 }