class ExceptionMessageFormatterUtil {

    public static void formatAccessDeniedMessage(Runnable r, String resourceName, Long id) {
        try {
            r.run();
        } catch (AccessDeniedException e) {
            throw new AccessDeniedException(
                    String.format("Access to %s '%s' is denied or %s doesn't exist.", resourceName, id, resourceName), e);
        }
    }

    private  ExceptionMessageFormatterUtil();

}