class ResourceBinderImpl implements ResourceBinder {

    @Override
    public void addResource(Class<?> resourceClass, MultivaluedMap<String, String> properties) {
        if (!resourceClass.isAnnotationPresent(Path.class)) {
            throw new ResourcePublicationException(String.format(
                    "Resource class %s it is not root resource. Path annotation javax.ws.rs.Path is not specified for this class.",
                    resourceClass.getName()));
        }
        try {
            addResource(new PerRequestObjectFactory<>(newResourceDescriptor(null, resourceClass, properties)));
        } catch (ResourcePublicationException e) {
            throw e;
        } catch (Exception e) {
            throw new ResourcePublicationException(e.getMessage(), e);
        }
    }

}