public List < String > getRoleNames ( final Optional < Subject > subjectOption ) { final List < String > roleNames = new ArrayList < String > ( ) ; subjectOption . ifPresent ( subject -> { final List < ? extends Role > roles = subject . getRoles ( ) ; if ( roles != null ) { for ( Role role : roles ) { if ( role != null ) { roleNames . add ( role . getName ( ) ) ; } } } } ) ; return roleNames ; }
Gets the role name of each role held .