/** * Gets the category with the given identifier. If no such category * currently exists, then the category will be created (but be undefined). * * @param categoryId * The identifier to find; must not be <code>null</code>. If * the category is <code>null</code>, then a category suitable * for uncategorized items is defined and returned. * @return The category with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see Category */ public final Category getCategory(final String categoryId) { if (categoryId == null) { return getCategory(AUTOGENERATED_CATEGORY_ID); } checkId(categoryId); Category category = categoriesById.get(categoryId); if (category == null) { category = new Category(categoryId); categoriesById.put(categoryId, category); category.addCategoryListener(this); } return category; }
/** * Gets the category with the given identifier. If no such category * currently exists, then the category will be created (but be undefined). * * @param categoryId * The identifier to find; must not be <code>null</code>. If * the category is <code>null</code>, then a category suitable * for uncategorized items is defined and returned. * @return The category with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see Category */ public Category getCategory(final String categoryId) { if (categoryId == null) { return getCategory(AUTOGENERATED_CATEGORY_ID); } checkId(categoryId); Category category = categoriesById.get(categoryId); if (category == null) { category = new Category(categoryId); categoriesById.put(categoryId, category); category.addCategoryListener(this); } return category; }
/** * Gets the category with the given identifier. If no such category * currently exists, then the category will be created (but be undefined). * * @param categoryId * The identifier to find; must not be <code>null</code>. If * the category is <code>null</code>, then a category suitable * for uncategorized items is defined and returned. * @return The category with the given identifier; this value will never be * <code>null</code>, but it might be undefined. * @see Category */ public final Category getCategory(final String categoryId) { if (categoryId == null) { return getCategory(AUTOGENERATED_CATEGORY_ID); } checkId(categoryId); Category category = categoriesById.get(categoryId); if (category == null) { category = new Category(categoryId); categoriesById.put(categoryId, category); category.addCategoryListener(this); } return category; }