public Map < String , Set < Privilege > > ymlToPrivileges ( String yml ) { try { Map < String , Set < Privilege > > map = mapper . readValue ( yml , new TypeReference < TreeMap < String , TreeSet < Privilege > > > ( ) { } ) ; map . forEach ( ( msName , privileges ) -> privileges . forEach ( privilege -> privilege . setMsName ( msName ) ) ) ; return Collections . unmodifiableMap ( map ) ; } catch ( Exception e ) { log . error ( "Failed to create privileges collection from YML file, error: {}" , e . getMessage ( ) , e ) ; } return Collections . emptyMap ( ) ; }
Convert privileges yml string to map .