public class CommonConfig extends Object implements FeatureContext, ExtendedConfig
Configuration
implementation for
server and client.Constructor and Description |
---|
CommonConfig(CommonConfig config)
Copy constructor.
|
CommonConfig(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(InjectionManager injectionManager,
Collection<AutoDiscoverable> autoDiscoverables,
boolean forcedOnly)
Configure
auto-discoverables in the injection manager. |
void |
configureMetaProviders(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() |
RuntimeType |
getRuntimeType() |
int |
hashCode() |
boolean |
isEnabled(Class<? extends Feature> featureClass) |
boolean |
isEnabled(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(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(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 Configurable<FeatureContext>
public RuntimeType getRuntimeType()
getRuntimeType
in interface Configuration
public Map<String,Object> getProperties()
getProperties
in interface Configuration
public Object getProperty(String name)
getProperty
in interface 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 Configuration
public boolean isEnabled(Class<? extends Feature> featureClass)
isEnabled
in interface Configuration
public boolean isEnabled(Feature feature)
isEnabled
in interface Configuration
public boolean isRegistered(Object component)
isRegistered
in interface Configuration
public boolean isRegistered(Class<?> componentClass)
isRegistered
in interface Configuration
public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
getContracts
in interface Configuration
public Set<Class<?>> getClasses()
getClasses
in interface Configuration
public Set<Object> getInstances()
getInstances
in interface 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 Configurable<FeatureContext>
public CommonConfig register(Class<?> componentClass)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Class<?> componentClass, int bindingPriority)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Class<?> componentClass, Class<?>... contracts)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Class<?> componentClass, Map<Class<?>,Integer> contracts)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Object component)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Object component, int bindingPriority)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Object component, Class<?>... contracts)
register
in interface Configurable<FeatureContext>
public CommonConfig register(Object component, Map<Class<?>,Integer> contracts)
register
in interface Configurable<FeatureContext>
public CommonConfig loadFrom(Configuration config)
config
- external configuration state to replace the configuration of this configurable instance.public void configureAutoDiscoverableProviders(InjectionManager injectionManager, Collection<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(InjectionManager injectionManager, ManagedObjectsFinalizer finalizer)
injectionManager
- injection manager in which the binders and features should be configured.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.