Class CommonConfig
java.lang.Object
org.glassfish.jersey.model.internal.CommonConfig
- All Implemented Interfaces:
Configurable<FeatureContext>
,Configuration
,FeatureContext
,ExtendedConfig
- Direct Known Subclasses:
ImmutableCommonConfig
Common immutable
Configuration
implementation for
server and client.- Author:
- Michal Gajdos, Marek Potociar
-
Constructor Summary
ConstructorDescriptionCommonConfig
(RuntimeType type, Predicate<ContractProvider> registrationStrategy) Create a newRuntimeConfig
instance.CommonConfig
(CommonConfig config) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddProperties
(Map<String, ?> properties) Add properties toResourceConfig
.void
configureAutoDiscoverableProviders
(org.glassfish.jersey.internal.inject.InjectionManager injectionManager, Collection<org.glassfish.jersey.internal.spi.AutoDiscoverable> autoDiscoverables, boolean forcedOnly) Configureauto-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
final ComponentBag
Returns aComponentBag
instance associated with the configuration.getContracts
(Class<?> componentClass) 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.getProperty
(String name) int
hashCode()
boolean
boolean
boolean
isProperty
(String name) Get the value of the property with a given name converted toboolean
.boolean
isRegistered
(Class<?> componentClass) boolean
isRegistered
(Object component) loadFrom
(Configuration config) Load the internal configuration state from an externally provided configuration state.setProperties
(Map<String, ?> properties) Set the configured properties to the provided map of properties.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.ws.rs.core.Configuration
hasProperty
-
Constructor Details
-
CommonConfig
Create a newRuntimeConfig
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.
- Parameters:
type
- configuration runtime type.registrationStrategy
- function driving the decision (based on the introspectedcontract provider model
) whether or not should the component class registration continue towards a successful completion.
-
CommonConfig
Copy constructor.- Parameters:
config
- configurable to copy class properties from.
-
-
Method Details
-
getConfiguration
- Specified by:
getConfiguration
in interfaceConfigurable<FeatureContext>
-
getRuntimeType
- Specified by:
getRuntimeType
in interfaceConfiguration
-
getProperties
- Specified by:
getProperties
in interfaceConfiguration
-
getProperty
- Specified by:
getProperty
in interfaceConfiguration
-
isProperty
Description copied from interface:ExtendedConfig
Get the value of the property with a given name converted toboolean
. Returnsfalse
if the value is not convertible.- Specified by:
isProperty
in interfaceExtendedConfig
- Parameters:
name
- property name.- Returns:
boolean
property value orfalse
if the property is not convertible.
-
getPropertyNames
- Specified by:
getPropertyNames
in interfaceConfiguration
-
isEnabled
- Specified by:
isEnabled
in interfaceConfiguration
-
isEnabled
- Specified by:
isEnabled
in interfaceConfiguration
-
isRegistered
- Specified by:
isRegistered
in interfaceConfiguration
-
isRegistered
- Specified by:
isRegistered
in interfaceConfiguration
-
getContracts
- Specified by:
getContracts
in interfaceConfiguration
-
getClasses
- Specified by:
getClasses
in interfaceConfiguration
-
getInstances
- Specified by:
getInstances
in interfaceConfiguration
-
getComponentBag
Returns aComponentBag
instance associated with the configuration.- Returns:
- a non-null component bag instance.
-
getModelEnhancer
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. Default implementation return an enhancer just builds the model.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.
- Parameters:
componentClass
- class of the component being registered.- Returns:
- filter for the contracts that being registered for a given component class.
-
setProperties
Set the configured properties to the provided map of properties.- Parameters:
properties
- new map of properties to be set.- Returns:
- updated configuration instance.
-
addProperties
Add properties toResourceConfig
. If any of the added properties exists already, he values of the existing properties will be replaced with new values.- Parameters:
properties
- properties to add.- Returns:
- updated configuration instance.
-
property
- Specified by:
property
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
register
- Specified by:
register
in interfaceConfigurable<FeatureContext>
-
loadFrom
Load the internal configuration state from an externally provided configuration state. Calling this method effectively replaces existing configuration state of the instance with the state represented by the externally provided configuration. If the features, auto-discoverables of given config has been already configured then this method will make sure to not configure them for the second time.- Parameters:
config
- external configuration state to replace the configuration of this configurable instance.- Returns:
- the updated common configuration instance.
-
configureAutoDiscoverableProviders
public void configureAutoDiscoverableProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager, Collection<org.glassfish.jersey.internal.spi.AutoDiscoverable> autoDiscoverables, boolean forcedOnly) Configureauto-discoverables
in the injection manager.- Parameters:
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.
-
configureMetaProviders
public void configureMetaProviders(org.glassfish.jersey.internal.inject.InjectionManager injectionManager, ManagedObjectsFinalizer finalizer) Configure binders in the injection manager and enable JAX-RS features.- Parameters:
injectionManager
- injection manager in which the binders and features should be configured.
-
equals
-
hashCode
public int hashCode()
-