public class CommonConfig extends Object implements javax.ws.rs.core.FeatureContext, ExtendedConfig
Configuration
implementation for
server and client.Constructor and Description |
---|
CommonConfig(CommonConfig config)
Copy constructor.
|
CommonConfig(javax.ws.rs.RuntimeType type,
Predicate<ContractProvider> registrationStrategy)
Create a new
RuntimeConfig instance. |
Modifier and Type | Method and Description |
---|---|
CommonConfig |
addProperties(Map<String,?> properties)
Add properties to
ResourceConfig . |
void |
configureAutoDiscoverableProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager,
Collection<org.glassfish.jersey.internal.spi.AutoDiscoverable> autoDiscoverables,
boolean forcedOnly)
Configure
auto-discoverables in the injection manager. |
void |
configureMetaProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager,
ManagedObjectsFinalizer finalizer)
Configure binders in the injection manager and enable JAX-RS features.
|
boolean |
equals(Object o) |
Set<Class<?>> |
getClasses() |
ComponentBag |
getComponentBag()
Returns a
ComponentBag instance associated with the configuration. |
ExtendedConfig |
getConfiguration() |
Map<Class<?>,Integer> |
getContracts(Class<?> componentClass) |
Set<Object> |
getInstances() |
protected Inflector<ContractProvider.Builder,ContractProvider> |
getModelEnhancer(Class<?> componentClass)
An extension point that provides a way how to define a custom enhancement/update
operation of a contract provider model registration being produced for a given
component class.
|
Map<String,Object> |
getProperties() |
Object |
getProperty(String name) |
Collection<String> |
getPropertyNames() |
javax.ws.rs.RuntimeType |
getRuntimeType() |
int |
hashCode() |
boolean |
isEnabled(Class<? extends javax.ws.rs.core.Feature> featureClass) |
boolean |
isEnabled(javax.ws.rs.core.Feature feature) |
boolean |
isProperty(String name)
Get the value of the property with a given name converted to
boolean . |
boolean |
isRegistered(Class<?> componentClass) |
boolean |
isRegistered(Object component) |
CommonConfig |
loadFrom(javax.ws.rs.core.Configuration config)
Load the internal configuration state from an externally provided configuration state.
|
CommonConfig |
property(String name,
Object value) |
CommonConfig |
register(Class<?> componentClass) |
CommonConfig |
register(Class<?> componentClass,
Class<?>... contracts) |
CommonConfig |
register(Class<?> componentClass,
int bindingPriority) |
CommonConfig |
register(Class<?> componentClass,
Map<Class<?>,Integer> contracts) |
CommonConfig |
register(Object component) |
CommonConfig |
register(Object component,
Class<?>... contracts) |
CommonConfig |
register(Object component,
int bindingPriority) |
CommonConfig |
register(Object component,
Map<Class<?>,Integer> contracts) |
CommonConfig |
setProperties(Map<String,?> properties)
Set the configured properties to the provided map of properties.
|
public CommonConfig(javax.ws.rs.RuntimeType type, Predicate<ContractProvider> registrationStrategy)
RuntimeConfig
instance.
The constructor provides a way for defining a contract
provider model
registration strategy. Once a registration model is built
for a newly registered contract, the provided registration strategy filter is
consulted whether the model should be registered or not.
Clients can use the method to cancel any contract provider model registration that does not meet the criteria of a given configuration context, such as a model that does not have any recognized contracts associated with it.
type
- configuration runtime type.registrationStrategy
- function driving the decision (based on the introspected
contract provider model
) whether
or not should the component class registration continue
towards a successful completion.public CommonConfig(CommonConfig config)
config
- configurable to copy class properties from.public ExtendedConfig getConfiguration()
getConfiguration
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public javax.ws.rs.RuntimeType getRuntimeType()
getRuntimeType
in interface javax.ws.rs.core.Configuration
public Map<String,Object> getProperties()
getProperties
in interface javax.ws.rs.core.Configuration
public Object getProperty(String name)
getProperty
in interface javax.ws.rs.core.Configuration
public boolean isProperty(String name)
ExtendedConfig
boolean
.
Returns false
if the value is not convertible.isProperty
in interface ExtendedConfig
name
- property name.boolean
property value or false
if the property is not
convertible.public Collection<String> getPropertyNames()
getPropertyNames
in interface javax.ws.rs.core.Configuration
public boolean isEnabled(Class<? extends javax.ws.rs.core.Feature> featureClass)
isEnabled
in interface javax.ws.rs.core.Configuration
public boolean isEnabled(javax.ws.rs.core.Feature feature)
isEnabled
in interface javax.ws.rs.core.Configuration
public boolean isRegistered(Object component)
isRegistered
in interface javax.ws.rs.core.Configuration
public boolean isRegistered(Class<?> componentClass)
isRegistered
in interface javax.ws.rs.core.Configuration
public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
getContracts
in interface javax.ws.rs.core.Configuration
public Set<Class<?>> getClasses()
getClasses
in interface javax.ws.rs.core.Configuration
public Set<Object> getInstances()
getInstances
in interface javax.ws.rs.core.Configuration
public final ComponentBag getComponentBag()
ComponentBag
instance associated with the configuration.protected Inflector<ContractProvider.Builder,ContractProvider> getModelEnhancer(Class<?> componentClass)
Derived implementations may use this method to e.g. filter out all contracts not applicable in the given configuration context or change the model scope. The returned set of filtered contracts is then used for the actual provider registration.
componentClass
- class of the component being registered.public CommonConfig setProperties(Map<String,?> properties)
properties
- new map of properties to be set.public CommonConfig addProperties(Map<String,?> properties)
ResourceConfig
.
If any of the added properties exists already, he values of the existing
properties will be replaced with new values.properties
- properties to add.public CommonConfig property(String name, Object value)
property
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Class<?> componentClass)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Class<?> componentClass, int bindingPriority)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Class<?> componentClass, Class<?>... contracts)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Class<?> componentClass, Map<Class<?>,Integer> contracts)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Object component)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Object component, int bindingPriority)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Object component, Class<?>... contracts)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig register(Object component, Map<Class<?>,Integer> contracts)
register
in interface javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
public CommonConfig loadFrom(javax.ws.rs.core.Configuration config)
config
- external configuration state to replace the configuration of this configurable instance.public void configureAutoDiscoverableProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager, Collection<org.glassfish.jersey.internal.spi.AutoDiscoverable> autoDiscoverables, boolean forcedOnly)
auto-discoverables
in the injection manager.injectionManager
- injection manager in which the auto-discoverables should be configured.autoDiscoverables
- list of registered auto discoverable components.forcedOnly
- defines whether all or only forced auto-discoverables should be configured.public void configureMetaProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager, ManagedObjectsFinalizer finalizer)
injectionManager
- injection manager in which the binders and features should be configured.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.