private static List < String > toSingletonList ( String propertyName , String value ) { if ( ( null == value ) || ( value . length ( ) == 0 ) ) { return null ; } if ( value . charAt ( 0 ) == ' ' ) { // These are very common, so we use shared copies // of these collections instead of re-creating. List < String > list ; if ( ALL . equals ( value ) ) { list = ALL_LIST ; } else if ( FORM . equals ( value ) ) { list = FORM_LIST ; } else if ( THIS . equals ( value ) ) { list = THIS_LIST ; } else if ( NONE . equals ( value ) ) { list = NONE_LIST ; } else { // RELEASE_PENDING i18n ; throw new FacesException ( value + " : Invalid id keyword specified for '" + propertyName + "' attribute" ) ; } return list ; } return Collections . singletonList ( value ) ; }
Converts a String with no spaces to a singleton list