/** * Takes a set of labels represented as a string and parses them out. * * @param labelsString a String containing labels separated by LabelsField#SEPARATOR_CHAR * @return a Set of Label */ public static Set<Label> buildFromString(String labelsString) { return buildFromString(new StringToLabel(), labelsString); }
private Set<Label> convertStringsToLabels(final Collection<String> labelStrings) { final Set<Label> ret = new LinkedHashSet<Label>(); for (String labelString : labelStrings) { if (labelString.length() > LabelParser.MAX_LABEL_LENGTH) { throw new FieldValidationException(authContext.getI18nHelper().getText("label.service.error.label.toolong", labelString)); } ret.addAll(LabelParser.buildFromString(labelString)); } return ret; }