javax.ws.rs.core.Configuration.getContracts()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中javax.ws.rs.core.Configuration.getContracts()方法的一些代码示例,展示了Configuration.getContracts()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getContracts()方法的具体详情如下:
包路径:javax.ws.rs.core.Configuration
类名称:Configuration
方法名:getContracts

Configuration.getContracts介绍

[英]Get the extension contract registration information for a component of a given class. For component classes that are not configured in this configuration context the method returns an empty Map. Method does not return null.
[中]

代码示例

代码示例来源:origin: jersey/jersey

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: jersey/jersey

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: jersey/jersey

register(clazz, config.getContracts(clazz));
register(instance, config.getContracts(instance.getClass()));

代码示例来源:origin: jersey/jersey

register(clazz, config.getContracts(clazz));
register(instance, config.getContracts(instance.getClass()));

代码示例来源:origin: resteasy/Resteasy

@Override
public Map<Class<?>, Integer> getContracts(Class<?> componentClass)
{
 Map<Class<?>, Integer> contracts = new HashMap<>();
 contracts.putAll(getLocalContracts(componentClass));
 contracts.putAll(delegate.getContracts(componentClass));
 return contracts;
}

代码示例来源:origin: org.glassfish.jersey.core/jersey-server

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

代码示例来源:origin: resteasy/Resteasy

@Override
public ResteasyClientBuilderImpl withConfig(Configuration config)
{
 providerFactory = new LocalResteasyProviderFactory(new ResteasyProviderFactoryImpl());
 providerFactory.setProperties(config.getProperties());
 for (Class clazz : config.getClasses())
 {
   Map<Class<?>, Integer> contracts = config.getContracts(clazz);
   try {
    register(clazz, contracts);
   }
   catch (RuntimeException e) {
    throw new RuntimeException(Messages.MESSAGES.failedOnRegisteringClass(clazz.getName()), e);
   }
 }
 for (Object obj : config.getInstances())
 {
   Map<Class<?>, Integer> contracts = config.getContracts(obj.getClass());
   register(obj, contracts);
 }
 return this;
}

代码示例来源:origin: io.smallrye/smallrye-rest-client

@Override
public Map<Class<?>, Integer> getContracts(Class<?> componentClass) {
  Map<Class<?>, Integer> contracts = new HashMap<>();
  contracts.putAll(getLocalContracts(componentClass));
  contracts.putAll(delegate.getContracts(componentClass));
  return contracts;
}

代码示例来源:origin: io.thorntail/microprofile-restclient-api

@Override
public Map<Class<?>, Integer> getContracts(Class<?> componentClass) {
  Map<Class<?>, Integer> contracts = new HashMap<>();
  contracts.putAll(getLocalContracts(componentClass));
  contracts.putAll(delegate.getContracts(componentClass));
  return contracts;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-client-microprofile

@Override
public Map<Class<?>, Integer> getContracts(Class<?> componentClass)
{
 Map<Class<?>, Integer> contracts = new HashMap<>();
 contracts.putAll(getLocalContracts(componentClass));
 contracts.putAll(delegate.getContracts(componentClass));
 return contracts;
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public Map<Class<?>, Integer> getContracts(final Class<?> componentClass) {
  return get().getContracts(componentClass);
}

代码示例来源:origin: apache/cxf

private int getPriority(Class<?> clazz) {
    Map<Class<?>, Integer> contracts = microProfileClientFactoryBean.getConfiguration()
        .getContracts(clazz);
    if (contracts != null && !contracts.isEmpty()) {
      for (Class<?> providerClass : CONTRACTS) {
        Integer priority = contracts.get(providerClass);
        if (priority != null) {
          return priority;
        }
      }
    }
    return AnnotationUtils.getBindingPriority(clazz);
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: apache/cxf

private void registerParentProvider(Object o, Configuration parent) {
  Map<Class<?>, Integer> contracts = parent.getContracts(o.getClass());
  if (contracts != null) {
    providers.put(o, contracts);
  } else {
    register(o, AnnotationUtils.getBindingPriority(o.getClass()), 
          ConfigurableImpl.getImplementedContracts(o, new Class<?>[]{}));
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-mp-client

private int getPriority(Class<?> clazz) {
    Map<Class<?>, Integer> contracts = microProfileClientFactoryBean.getConfiguration()
        .getContracts(clazz);
    if (contracts != null && !contracts.isEmpty()) {
      for (Class<?> providerClass : CONTRACTS) {
        Integer priority = contracts.get(providerClass);
        if (priority != null) {
          return priority;
        }
      }
    }
    return AnnotationUtils.getBindingPriority(clazz);
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private void copyProviders(Configuration source, Configurable<?> target) {
  for (Class<?> c : source.getClasses()) {
    target.register(c, source.getContracts(c));
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    target.register(c, source.getContracts(c));
  }
}

代码示例来源:origin: apache/cxf

private Set<Object> processProviders() {
    Set<Object> providers = new LinkedHashSet<>();
    for (Object provider : configuration.getInstances()) {
      Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider);
      if (provider instanceof ClientRequestFilter || provider instanceof ClientResponseFilter) {
        FilterProviderInfo<Object> filter = new FilterProviderInfo<>(providerCls, providerCls,
            provider, getBus(), configuration.getContracts(providerCls));
        providers.add(filter);
      } else {
        providers.add(provider);
      }
    }
    return providers;
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-rs-mp-client

private Set<Object> processProviders() {
    Set<Object> providers = new LinkedHashSet<>();
    for (Object provider : configuration.getInstances()) {
      Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider);
      if (provider instanceof ClientRequestFilter || provider instanceof ClientResponseFilter) {
        FilterProviderInfo<Object> filter = new FilterProviderInfo<>(providerCls, providerCls,
            provider, getBus(), configuration.getContracts(providerCls));
        providers.add(filter);
      } else {
        providers.add(provider);
      }
    }
    return providers;
  }
}

代码示例来源:origin: org.glassfish.jersey.bundles/jaxrs-ri

private void copyProviders(Configuration source, Configurable<?> target) {
  final Configuration targetConfig = target.getConfiguration();
  for (Class<?> c : source.getClasses()) {
    if (!targetConfig.isRegistered(c)) {
      target.register(c, source.getContracts(c));
    }
  }
  for (Object o : source.getInstances()) {
    Class<?> c = o.getClass();
    if (!targetConfig.isRegistered(o)) {
      target.register(c, source.getContracts(c));
    }
  }
}

相关文章