public Role getOrCreateRole ( JsonNode data ) { long id = Long . parseLong ( data . get ( "id" ) . asText ( ) ) ; synchronized ( this ) { return getRoleById ( id ) . orElseGet ( ( ) -> { Role role = new RoleImpl ( api , this , data ) ; this . roles . put ( role . getId ( ) , role ) ; return role ; } ) ; } }
Gets or create a new role .