/** * Helper function to extract the group parameter from the binding config, * * @param c the binding configuration to test * @return the value of the "group" parameter, or -1 if none */ protected static int s_getGroup(InsteonPLMBindingConfig c) { String v = c.getParameters().get("group"); int iv = -1; try { iv = (v == null) ? -1 : Utils.strToInt(v); } catch (NumberFormatException e) { logger.error("malformed int parameter in for item {}", c.getItemName()); } return iv; }
/** * Returns parameter as integer * * @param key key of parameter * @param def default * @return value of parameter */ protected int getIntParameter(String key, int def) { String val = m_parameters.get(key); if (val == null) return (def); // param not found int ret = def; try { ret = Utils.strToInt(val); } catch (NumberFormatException e) { logger.error("malformed int parameter in command handler: {}", key); } return ret; }