本文整理了Java中javax.ws.rs.core.Configuration.getInstances()
方法的一些代码示例,展示了Configuration.getInstances()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getInstances()
方法的具体详情如下:
包路径:javax.ws.rs.core.Configuration
类名称:Configuration
方法名:getInstances
[英]Get the immutable set of registered JAX-RS component (such as provider or Feature) instances to be utilized by the configurable instance. Fields and properties of returned instances are injected with their declared dependencies (see Context) by the runtime prior to use.
For each component type, there can be only a single class-based or instance-based registration present in the configuration context at any given time.
[中]获取注册的JAX-RS组件(例如提供者或特性)实例的不可变集合,以供可配置实例使用。返回实例的字段和属性在使用前由运行时注入其声明的依赖项(请参见上下文)。
对于每种组件类型,在任何给定时间,配置上下文中只能存在一个基于类或基于实例的注册。
代码示例来源: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
for (final Object instance : config.getInstances()) {
if (instance instanceof Feature && config.isEnabled((Feature) instance)) {
this.disableMetaProviderConfiguration = true;
代码示例来源:origin: jersey/jersey
for (final Object instance : config.getInstances()) {
if (instance instanceof Feature && config.isEnabled((Feature) instance)) {
this.disableMetaProviderConfiguration = true;
代码示例来源:origin: resteasy/Resteasy
@Override
public Set<Object> getInstances()
{
return delegate.getInstances();
}
代码示例来源: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: org.jboss.resteasy/resteasy-client-microprofile
@Override
public Set<Object> getInstances()
{
return delegate.getInstances();
}
代码示例来源:origin: io.thorntail/microprofile-restclient-api
@Override
public Set<Object> getInstances() {
return delegate.getInstances();
}
代码示例来源:origin: io.smallrye/smallrye-rest-client
@Override
public Set<Object> getInstances() {
return delegate.getInstances();
}
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public Set<Object> getInstances() {
return get().getInstances();
}
}
代码示例来源:origin: com.oracle.ozark/ozark
@Override
public void configure(FeatureContext context) {
final Configuration config = context.getConfiguration();
if (config.isRegistered(ViewResponseFilter.class)) {
return; // already registered!
}
final boolean enableOzark = config.getClasses().stream().anyMatch(this::isController)
|| config.getInstances().stream().map(o -> o.getClass()).anyMatch(this::isController);
if (enableOzark) {
context.register(ViewResponseFilter.class);
context.register(ViewableWriter.class);
}
}
代码示例来源: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.apache.geronimo/geronimo-opentracing-common
@Override
public ClientBuilder configure(final ClientBuilder builder, final ExecutorService executorService) {
if (builder.getConfiguration().getInstances().stream().anyMatch(it -> requestFilter == it)) {
return builder;
}
return builder.register(requestFilter).register(responseFilter)
.executorService(wrapExecutor(executorService));
}
代码示例来源:origin: apache/cxf
public ConfigurationImpl(Configuration parent) {
if (parent != null) {
this.props.putAll(parent.getProperties());
this.runtimeType = parent.getRuntimeType();
Set<Class<?>> providerClasses = new HashSet<>(parent.getClasses());
for (Object o : parent.getInstances()) {
if (!(o instanceof Feature)) {
registerParentProvider(o, parent);
} else {
Feature f = (Feature)o;
features.put(f, parent.isEnabled(f));
}
providerClasses.remove(o.getClass());
}
for (Class<?> cls : providerClasses) {
registerParentProvider(createProvider(cls), parent);
}
}
}
代码示例来源: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: 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: 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));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!