/* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { final StringBuilder sb = new StringBuilder(); SortedSet<Option> union = new TreeSet<Option>(savedOptionMap.keySet()); union.addAll(dependenciesResolvedOptionMap.keySet()); union.addAll(commandLineOptionMap.keySet()); union.addAll(optionFileOptionMap.keySet()); for (Option option : union) { Object value = null; for (int i = OptionContainer.SAVEDOPTION; i <= OptionContainer.OPTIONFILE; i++) { if (i == OptionContainer.SAVEDOPTION) { value = savedOptionMap.get(option); } else if (i == OptionContainer.DEPENDENCIES_RESOLVED) { value = dependenciesResolvedOptionMap.get(option); } else if (i == OptionContainer.COMMANDLINE) { value = commandLineOptionMap.get(option); } else if (i == OptionContainer.OPTIONFILE) { value = optionFileOptionMap.get(option); } if (value != null) { break; } } sb.append(option.getGroup().getName() + "\t" + option.getName() + "\t" + value + "\n"); } return sb.toString(); }
/** * Returns a string representation of the option value for the specified option. It uses the * priority amongst the internal option containers. * * @param option the option object * @return a string representation of the option value */ public String getOptionValueString(Option option) { String value = null; for (int i = OptionContainer.SAVEDOPTION; i <= OptionContainer.OPTIONFILE; i++) { if (i == OptionContainer.SAVEDOPTION) { value = option.getStringRepresentation(savedOptionMap.get(option)); } else if (i == OptionContainer.DEPENDENCIES_RESOLVED) { value = option.getStringRepresentation(dependenciesResolvedOptionMap.get(option)); } else if (i == OptionContainer.COMMANDLINE) { value = option.getStringRepresentation(commandLineOptionMap.get(option)); } else if (i == OptionContainer.OPTIONFILE) { value = option.getStringRepresentation(optionFileOptionMap.get(option)); } if (value != null) { return value; } } return null; }