Ejemplo n.º 1
0
 /**
  * Attempts to create an item from the ItemPreset specified by an ID with the provided creation
  * date.
  *
  * <p>The caller should ensure that this ItemFactory can make this item after taking its
  * restrictions into account by calling canMakeItem with this Id.
  *
  * @param id the ID of the preset, not null
  * @param date the creation date of the item, not null
  * @return an Item with the specified creation date
  */
 public Item makeItem(@NotNull Id id, @NotNull Date date) {
   ItemPreset itemPreset = getItemPresets().get(id);
   if (itemPreset == null) {
     throw new IllegalArgumentException("id (" + id + ") does not correspond to an ItemPreset.");
   }
   Item item = new Item(itemPreset, date);
   restrictions.registerItem(item.getId());
   return item;
 }
Ejemplo n.º 2
0
 /**
  * Returns whether or not this ItemFactory can make an Item with the specified Id based on its
  * restrictions.
  */
 public boolean canMakeItem(@NotNull Id id) {
   return restrictions.canMakeItem(id);
 }