Beispiel #1
0
 /**
  * Validate that a {@link FieldMapping} is compatible with this builder's current set of
  * mappings and add it to the set of mappings.
  *
  * <p>A mapping is not compatible if it results in:
  *
  * <pre>
  * 1. Multiple occVersion mappings in the mapping set
  * 2. Both a counter and an occVersion mapping in the mapping set
  * </pre>
  *
  * @param fm a {@code FieldMapping} to add to this builder
  */
 private void addField(FieldMapping fm) {
   // validate!
   if (fm.getMappingType() == FieldMapping.MappingType.OCC_VERSION) {
     ValidationException.check(!hasOCCVersion, "Cannot use multiple occVersion fields");
     ValidationException.check(!hasCounter, "Cannot use both counter and occVersion fields");
     hasOCCVersion = true;
   } else if (fm.getMappingType() == FieldMapping.MappingType.COUNTER) {
     ValidationException.check(!hasOCCVersion, "Cannot use both counter and occVersion fields");
     hasCounter = true;
   }
   fieldMappings.add(fm);
 }
Beispiel #2
0
 private void add(FieldPartitioner fp) {
   ValidationException.check(
       !names.contains(fp.getName()),
       "Partition name %s conflicts with an existing field or partition name",
       fp.getName());
   fieldPartitioners.add(fp);
   names.add(fp.getName());
 }