Exemplo n.º 1
0
 private void createUniquenessRestrictions() {
   Set<Id> uniqueIds = new HashSet<>();
   for (ItemPreset itemPreset : getItemPresets().values()) {
     if (itemPreset.isUnique()) {
       uniqueIds.add(itemPreset.getId());
     }
   }
   restrictions = new UniquenessRestrictions(uniqueIds);
 }
Exemplo n.º 2
0
 /**
  * Iterates over all presets of a Collection, adding them to this factory after they are
  * validated.
  */
 private void addAllPresets(Collection<ItemPreset> presets) {
   for (ItemPreset preset : presets) {
     Id id = preset.getId();
     if (itemPresets.containsKey(id)) {
       throw new IllegalArgumentException(
           "factory already contains a preset with the Id " + preset.getId() + ".");
     }
     itemPresets.put(id, preset);
   }
 }