/** * @param p_path path using # as delimiter. * @param p_optionDescription */ public void addOptionDescription(String p_path, OptionDescription p_optionDescription) { OptionGroup group = getOptionGroup(null, p_path); group.getOptions().add(p_optionDescription); if (p_optionDescription.getOption() instanceof ApplicationOption) { m_applicationOptions.add((ApplicationOption) p_optionDescription.getOption()); } else if (p_optionDescription.getOption() instanceof CompanyOption) { m_companyOptions.add((CompanyOption) p_optionDescription.getOption()); } else if (p_optionDescription.getOption() instanceof UserOption) { m_userOptions.add((UserOption) p_optionDescription.getOption()); } }
@SuppressWarnings("unchecked") private <T> List<T> getOptionsOfClass(OptionGroup p_group, Class<T> p_class) { List<T> result = new ArrayList<T>(); for (OptionDescription option : p_group.getOptions()) { if (option.getOption().getClass().equals(p_class)) { result.add((T) option.getOption()); } } for (OptionGroup group : p_group.getSubgroups()) { result.addAll(getOptionsOfClass(group, p_class)); } return result; }