String (String importStatementOnDemand) { if (importStatementOnDemand.endsWith(".*")) { return importStatementOnDemand.substring(0, importStatementOnDemand.length() - 2); } else { boolean hasClassname = StringUtil.hasUpperCaseChar(importStatementOnDemand); if (hasClassname) { // extract packagename part int pos = importStatementOnDemand.lastIndexOf("."); return importStatementOnDemand.substring(0, pos); } else { // it is a pure packagename return importStatementOnDemand; } } }