Interface ItemBuilder


@NonNullByDefault public interface ItemBuilder
This class allows the easy construction of an Item using the builder pattern.
Author:
Simon Kaufmann - Initial contribution
  • Method Details

    • build

      Item build()
      Creates an item with the currently configured values.
      Returns:
      an item
      Throws:
      IllegalStateException - in case no item factory can create the given item type
    • withLabel

      ItemBuilder withLabel(@Nullable String label)
      Set the label of the item.
      Parameters:
      label - the label
      Returns:
      the builder itself
    • withGroups

      ItemBuilder withGroups(@Nullable Collection<String> groups)
      Set the group membership of the item.
      Parameters:
      groups - the group names the item belongs to
      Returns:
      the builder itself
    • withCategory

      ItemBuilder withCategory(@Nullable String category)
      Set the category of the item.
      Parameters:
      category - the category
      Returns:
      the builder itself
    • withBaseItem

      ItemBuilder withBaseItem(@Nullable Item baseItem)
      Set the base item..
      Parameters:
      baseItem - the base item
      Returns:
      the builder itself
      Throws:
      IllegalArgumentException - in case this is not a group item
    • withGroupFunction

      ItemBuilder withGroupFunction(@Nullable GroupFunction function)
      Set the group function
      Parameters:
      function - the group function
      Returns:
      the builder itself
      Throws:
      IllegalArgumentException - in case this is not a group item
    • withTags

      ItemBuilder withTags(@Nullable Set<String> tags)
      Set the tags
      Parameters:
      tags - the tags
      Returns:
      the builder itself