class RestComponentResolver {

    @SuppressWarnings({"unchecked"})
    public void addSingleton(Object instance) {
        Class clazz = instance.getClass();
        if (clazz.getAnnotation(Provider.class) != null) {
            if (instance instanceof ContextResolver) {
                providers.addContextResolver((ContextResolver)instance);
            }
            if (instance instanceof ExceptionMapper) {
                providers.addExceptionMapper((ExceptionMapper)instance);
            }
            if (instance instanceof MessageBodyReader) {
                providers.addMessageBodyReader((MessageBodyReader)instance);
            }
            if (instance instanceof MessageBodyWriter) {
                providers.addMessageBodyWriter((MessageBodyWriter)instance);
            }
        } else if (clazz.getAnnotation(Filter.class) != null) {
            if (instance instanceof MethodInvokerFilter) {
                providers.addMethodInvokerFilter((MethodInvokerFilter)instance);
            }
            if (instance instanceof RequestFilter) {
                providers.addRequestFilter((RequestFilter)instance);
            }
            if (instance instanceof ResponseFilter) {
                providers.addResponseFilter((ResponseFilter)instance);
            }
        } else if (clazz.getAnnotation(Path.class) != null) {
            resources.addResource(instance, null);
        }
    }

    public  RestComponentResolver(ResourceBinder resources, ProviderBinder providers);

}