@Test public void testGetOptionValues() { assertEquals(1, options.getOptionValues(optionKey).length); assertEquals(2, options.getOptionValues(multiOptionKey).length); assertEquals(0, options.getOptionValues("test").length); options.setOption(optionKey, optionValue); assertEquals(1, options.getOptionValues(optionKey).length); options.setOption(optionKey, "abc"); assertEquals(2, options.getOptionValues(optionKey).length); options.setOption(optionKey, "def"); assertEquals(3, options.getOptionValues(optionKey).length); options.setEnvironment(Environment.Staging); assertEquals(0, options.getOptionValues(environmentKey).length); options.setEnvironment(Environment.Production); assertEquals(2, options.getOptionValues(environmentKey).length); options.setEnvironment(Environment.Development); assertEquals(1, options.getOptionValues(environmentKey).length); }
public String[] getOptionValues(String name) { Map<Environment, List<String>> environments = options.get(name); if (environments == null) { environments = new HashMap<Environment, List<String>>(); options.put(name, environments); } List<String> optionList = environments.get(environment); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } optionList = environments.get(Environment.Any); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } return new String[] {}; }
OptionsHelper implements Customizable { public String[] getOptionValues(String name) { Map<Environment, List<String>> environments = options.get(name); if (environments == null) { environments = new HashMap<Environment, List<String>>(); options.put(name, environments); } List<String> optionList = environments.get(environment); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } optionList = environments.get(Environment.Any); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } return new String[] {}; } }
OptionsHelper implements Customizable { public String[] getOptionValues(String name) { Map<Environment, List<String>> environments = options.get(name); if (environments == null) { environments = new HashMap<Environment, List<String>>(); options.put(name, environments); } List<String> optionList = environments.get(environment); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } optionList = environments.get(Environment.Any); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } return new String[] {}; }  }
OptionsHelper implements Customizable { public String[] getOptionValues(String name) { Map<Environment, List<String>> environments = options.get(name); if (environments == null) { environments = new HashMap<Environment, List<String>>(); options.put(name, environments); } List<String> optionList = environments.get(environment); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } optionList = environments.get(Environment.Any); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } return new String[] {}; }  void setOption(String name, String value); void setOption(String name, String value, Environment environment); void removeOption(String name); boolean hasOption(String name); String[] getOptionNames(); String getOptionValue(String name); String getOptionValue(String name, String defaultValue); String[] getOptionValues(String name); Map<String, Map<Environment, List<String>>> getOptions(); static OptionsHelper fromXml(Node config); void setEnvironment(Environment environment); static OptionsHelper fromXml(Node config, XPath xpathProcessor); static void fromXml(Node config, Customizable customizable,
      XPath xpathProcessor); String toXml(); }
OptionsHelper implements Customizable { public String[] getOptionValues(String name) { Map<Environment, List<String>> environments = options.get(name); if (environments == null) { environments = new HashMap<Environment, List<String>>(); options.put(name, environments); } List<String> optionList = environments.get(environment); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } optionList = environments.get(Environment.Any); if (optionList != null && optionList.size() > 0) { return optionList.toArray(new String[optionList.size()]); } return new String[] {}; }  void setOption(String name, String value); void setOption(String name, String value, Environment environment); void removeOption(String name); boolean hasOption(String name); String[] getOptionNames(); String getOptionValue(String name); String getOptionValue(String name, String defaultValue); String[] getOptionValues(String name); Map<String, Map<Environment, List<String>>> getOptions(); static OptionsHelper fromXml(Node config); void setEnvironment(Environment environment); static OptionsHelper fromXml(Node config, XPath xpathProcessor); static void fromXml(Node config, Customizable customizable,
      XPath xpathProcessor); String toXml();  }