private void checkOptions()

in service/src/main/java/org/apache/fineract/cn/customer/catalog/internal/service/FieldValueValidator.java [148:160]


  private void checkOptions(final Value value, final FieldEntity fieldEntity, final List<OptionEntity> optionEntities, boolean singleSelection) {
    final Set<String> valuesAsSet = StringUtils.commaDelimitedListToSet(value.getValue());

    if (singleSelection && valuesAsSet.size() > 1) {
      throw ServiceException.badRequest("Field {0} only supports single selection.", fieldEntity.getLabel());
    }

    final HashSet<String> optionsAsSet = new HashSet<>(optionEntities.size());
    optionEntities.forEach(optionEntity -> optionsAsSet.add(optionEntity.getValue().toString()));
    if (!optionsAsSet.containsAll(valuesAsSet)) {
      throw ServiceException.badRequest("Unsupported option {0} for field {1}.", value.getValue(), fieldEntity.getLabel());
    }
  }