class ExceptionHandlerBinding {

    public static ExceptionHandlerBinding fromAnnotatedClass(Class<?> exceptionHandlerClass) {
        Assert.notNull(exceptionHandlerClass);
        RestExceptionHandlerProvider annotation = exceptionHandlerClass.getAnnotation(RestExceptionHandlerProvider.class);
        Assert.state(annotation != null, exceptionHandlerClass + " class in not annotated with @RestExceptionHandlerProvider");
        return builder()
                .exceptionHandlerClass(exceptionHandlerClass)
                .logger(LoggerFactory.getLogger(exceptionHandlerClass))
                .exceptionClass(getExceptionClass(exceptionHandlerClass))
                .exceptionHandlerBeanName(getHandlerBeanName(exceptionHandlerClass))
                .httpStatus(annotation.httpStatus())
                .cause(annotation.applicationCode())
                .logLevel(annotation.logLevel())
                .suppressStacktrace(annotation.suppressStackTrace())
                .suppressException(annotation.suppressException())
                .build();
    }

}