@ XmlTransient public static List < Role > convertToObjects ( String roleListingParam ) { if ( roleListingParam == null || roleListingParam . trim ( ) . isEmpty ( ) ) { return null ; } String [ ] listOfRoles = roleListingParam . split ( UtilGlobal . REG_EX_COMMA ) ; List < Role > returnVal = new ArrayList <> ( ) ; for ( String roleName : listOfRoles ) { Role roleToAdd = new Role ( ) ; roleToAdd . setName ( roleName . trim ( ) ) ; returnVal . add ( roleToAdd ) ; } return returnVal ; }
Convert the comma separated list of roles as objects .