docs: protected int resolveNrOfInstances(ActivityExecution execution) {
      int nrOfInstances = -1;
      if (loopCardinalityExpression != null) {
        nrOfInstances = resolveLoopCardinality(execution);
      } else if (collectionExpression != null) {
        Object obj = collectionExpression.getValue(execution);
        if (!(obj instanceof Collection)) {
          throw LOG.unresolvableExpressionException(collectionExpression.getExpressionText(), "Collection");
        }
        nrOfInstances = ((Collection<?>) obj).size();
      } else if (collectionVariable != null) {
        Object obj = execution.getVariable(collectionVariable);
        if (!(obj instanceof Collection)) {
          throw LOG.invalidVariableTypeException(collectionVariable, "Collection");
        }
        nrOfInstances = ((Collection<?>) obj).size();
      } else {
        throw LOG.resolveCollectionExpressionOrVariableReferenceException();
      }
      return nrOfInstances;
    }