List of usage examples for org.springframework.util StringUtils split
@Nullable public static String[] split(@Nullable String toSplit, @Nullable String delimiter)
From source file:ubic.gemma.web.propertyeditor.UserRolesPropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (!StringUtils.hasText(text)) { setValue(null);/* www.j ava2 s.c o m*/ } else { roles = new HashSet<UserRole>(); String trim = text.trim(); String[] roleNames = null; if (trim.contains(COMMA_DELIM)) roleNames = StringUtils.split(trim, COMMA_DELIM); else roleNames = new String[] { trim }; if (roleNames != null && roleNames.length != 0) { for (String roleName : roleNames) { log.debug(roleName); UserRole role = new UserRoleImpl(); role.setName(roleName); roles.add(role); } setValue(roles); } else { throw new IllegalArgumentException("Could not parse role(s): " + text); } } }