public void addSpecification(ItemSpecification itemSpecification) { int version = 0; for (ItemSpecification specification : itemSpecs) { if (specification.getClass().equals(itemSpecification.getClass())) { version++; } } itemSpecification.setVersion(version); itemSpecification.setItem(this); itemSpecs.add(itemSpecification); if (itemSpecification.getType() != null) { if (TextUtils.isEmpty(itemTypes)) itemTypes = ITEM_TYPES_SEP; itemTypes = itemTypes.concat(itemSpecification.getType().name() + ITEM_TYPES_SEP); } }