Interface Configuration
configurable JAX-RS context. Defines the components as
well as additional meta-data for the configured context.
A configuration state may be used to retrieve configuration information about of the associated JAX-RS context (e.g.
application, resource method, etc.) or component (e.g. Client,
WebTarget, etc.). Configuration information consists of properties, registered JAX-RS
component classes and/or instances.
This interface can be injected using the Context annotation.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionGet the immutable set of registered JAX-RS component (such as provider, root resource orfeature) classes to be instantiated, injected and utilized in the scope of the configurable instance.getContracts(Class<?> componentClass) Get the extension contract registration information for a component of a given class.Get the immutable set of registered JAX-RS component (such as provider orfeature) instances to be utilized by the configurable instance.Get the immutable bag of configuration properties.getProperty(String name) Get the value for the property with a given name.Returns an immutablecollectioncontaining the property names available within the context of the current configuration instance.Get the runtime type of this configuration context.booleanCheck if a particularfeatureinstance has been previously enabled in the runtime configuration context.booleanCheck if afeatureinstance offeatureClassclass has been previously enabled in the runtime configuration context.booleanisRegistered(Class<?> componentClass) Check if a JAX-RS component of the suppliedcomponentClassclass has been previously registered in the runtime configuration context.booleanisRegistered(Object component) Check if a particular JAX-RScomponentinstance (such as providers orfeatures) has been previously registered in the runtime configuration context.
-
Method Details
-
getRuntimeType
RuntimeType getRuntimeType()Get the runtime type of this configuration context.- Returns:
- configuration context runtime type.
-
getProperties
Get the immutable bag of configuration properties.- Returns:
- the immutable view of configuration properties.
-
getProperty
Get the value for the property with a given name.- Parameters:
name- property name.- Returns:
- the property value for the specified property name or
nullif the property with such name is not configured.
-
getPropertyNames
Collection<String> getPropertyNames()Returns an immutablecollectioncontaining the property names available within the context of the current configuration instance.Use the
getProperty(java.lang.String)method with a property name to get the value of a property.- Returns:
- an immutable
collectionof property names. - See Also:
-
isEnabled
Check if a particularfeatureinstance has been previously enabled in the runtime configuration context.Method returns
trueonly in case an instance equal to thefeatureinstance is already present among the features previously successfully enabled in the configuration context.- Parameters:
feature- a feature instance to test for.- Returns:
trueif the feature instance has been previously enabled in this configuration context,falseotherwise.
-
isEnabled
Check if afeatureinstance offeatureClassclass has been previously enabled in the runtime configuration context.Method returns
truein case any instance of thefeatureClassclass is already present among the features previously successfully enabled in the configuration context.- Parameters:
featureClass- a feature class to test for.- Returns:
trueif a feature of a given class has been previously enabled in this configuration context,falseotherwise.
-
isRegistered
Check if a particular JAX-RScomponentinstance (such as providers orfeatures) has been previously registered in the runtime configuration context.Method returns
trueonly in case an instance equal to thecomponentinstance is already present among the components previously registered in the configuration context.- Parameters:
component- a component instance to test for.- Returns:
trueif the component instance has been previously registered in this configuration context,falseotherwise.- See Also:
-
isRegistered
Check if a JAX-RS component of the suppliedcomponentClassclass has been previously registered in the runtime configuration context.Method returns
truein case a component of the suppliedcomponentClassclass is already present among the previously registered component classes or instances in the configuration context.- Parameters:
componentClass- a component class to test for.- Returns:
trueif a component of a given class has been previously registered in this configuration context,falseotherwise.- See Also:
-
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 emptyMap. Method does not returnnull.- Parameters:
componentClass- a component class for which to get contracts.- Returns:
- map of extension contracts and their priorities for which the component class is registered. May return an empty map in case the component has not been registered for any extension contract supported by the implementation.
-
getClasses
Get the immutable set of registered JAX-RS component (such as provider, root resource orfeature) classes to be instantiated, injected and utilized in the scope of the configurable instance. In contrast toApplication.getClasses()this method returns a complete runtime view and therefore also includes auto-discovered components.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.
- Returns:
- the immutable set of registered JAX-RS component classes. The returned value may be empty but will never be
null. - See Also:
-
getInstances
Get the immutable set of registered JAX-RS component (such as provider orfeature) instances to be utilized by the configurable instance. Fields and properties of returned instances are injected with their declared dependencies (seeContext) 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.
- Returns:
- the immutable set of registered JAX-RS component instances. The returned value may be empty but will never be
null. - See Also:
-