Java Code Examples for org.eclipse.microprofile.rest.client.annotation.RegisterProvider

The following examples show how to use org.eclipse.microprofile.rest.client.annotation.RegisterProvider. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: cxf   Source File: CxfTypeSafeClientBuilder.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public <T> T build(Class<T> aClass) {
    if (baseUri == null) {
        throw new IllegalStateException("baseUrl not set");
    }
    Validator.checkValid(aClass);
    RegisterProvider[] providers = aClass.getAnnotationsByType(RegisterProvider.class);
    Configuration config = configImpl.getConfiguration();
    if (providers != null) {
        for (RegisterProvider provider : providers) {
            if (!config.isRegistered(provider.value())) {
                if (provider.priority() == -1) {
                    register(provider.value());
                } else {
                    register(provider.value(), provider.priority());
                }
            }
        }
    }

    register(SseMessageBodyReader.class);

    listeners().forEach(l -> l.onNewClient(aClass, this));

    MicroProfileClientFactoryBean bean = new MicroProfileClientFactoryBean(configImpl,
        baseUri, aClass, executorService, secConfig);
    return bean.create(aClass);
}