-
public interface Configuration
A configuration state associated with aconfigurable
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
- Author:
- Marek Potociar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Set<Class<?>>
getClasses()
Get the immutable set of registered JAX-RS component (such as provider orfeature
) classes to be instantiated, injected and utilized in the scope of the configurable instance.Map<Class<?>,Integer>
getContracts(Class<?> componentClass)
Get the extension contract registration information for a component of a given class.Set<Object>
getInstances()
Get the immutable set of registered JAX-RS component (such as provider orfeature
) instances to be utilized by the configurable instance.Map<String,Object>
getProperties()
Get the immutable bag of configuration properties.Object
getProperty(String name)
Get the value for the property with a given name.Collection<String>
getPropertyNames()
Returns an immutablecollection
containing the property names available within the context of the current configuration instance.RuntimeType
getRuntimeType()
Get the runtime type of this configuration context.boolean
isEnabled(Class<? extends Feature> featureClass)
Check if afeature
instance offeatureClass
class has been previously enabled in the runtime configuration context.boolean
isEnabled(Feature feature)
Check if a particularfeature
instance has been previously enabled in the runtime configuration context.boolean
isRegistered(Class<?> componentClass)
Check if a JAX-RS component of the suppliedcomponentClass
class has been previously registered in the runtime configuration context.boolean
isRegistered(Object component)
Check if a particular JAX-RScomponent
instance (such as providers orfeatures
) has been previously registered in the runtime configuration context.
-
-
-
Method Detail
-
getRuntimeType
RuntimeType getRuntimeType()
Get the runtime type of this configuration context.- Returns:
- configuration context runtime type.
-
getProperties
Map<String,Object> getProperties()
Get the immutable bag of configuration properties.- Returns:
- the immutable view of configuration properties.
-
getProperty
Object getProperty(String name)
Get the value for the property with a given name.- Parameters:
name
- property name.- Returns:
- the property value for the specified property name or
null
if the property with such name is not configured.
-
getPropertyNames
Collection<String> getPropertyNames()
Returns an immutablecollection
containing 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
collection
of property names. - See Also:
getProperty(java.lang.String)
-
isEnabled
boolean isEnabled(Feature feature)
Check if a particularfeature
instance has been previously enabled in the runtime configuration context.Method returns
true
only in case an instance equal to thefeature
instance is already present among the features previously successfully enabled in the configuration context.- Parameters:
feature
- a feature instance to test for.- Returns:
true
if the feature instance has been previously enabled in this configuration context,false
otherwise.
-
isEnabled
boolean isEnabled(Class<? extends Feature> featureClass)
Check if afeature
instance offeatureClass
class has been previously enabled in the runtime configuration context.Method returns
true
in case any instance of thefeatureClass
class is already present among the features previously successfully enabled in the configuration context.- Parameters:
featureClass
- a feature class to test for.- Returns:
true
if a feature of a given class has been previously enabled in this configuration context,false
otherwise.
-
isRegistered
boolean isRegistered(Object component)
Check if a particular JAX-RScomponent
instance (such as providers orfeatures
) has been previously registered in the runtime configuration context.Method returns
true
only in case an instance equal to thecomponent
instance is already present among the components previously registered in the configuration context.- Parameters:
component
- a component instance to test for.- Returns:
true
if the component instance has been previously registered in this configuration context,false
otherwise.- See Also:
isEnabled(Feature)
-
isRegistered
boolean isRegistered(Class<?> componentClass)
Check if a JAX-RS component of the suppliedcomponentClass
class has been previously registered in the runtime configuration context.Method returns
true
in case a component of the suppliedcomponentClass
class is already present among the previously registered component classes or instances in the configuration context.- Parameters:
componentClass
- a component class to test for.- Returns:
true
if a component of a given class has been previously registered in this configuration context,false
otherwise.- See Also:
isEnabled(Class)
-
getContracts
Map<Class<?>,Integer> getContracts(Class<?> componentClass)
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
.- 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
Set<Class<?>> getClasses()
Get the immutable set of registered JAX-RS component (such as provider orfeature
) classes to be instantiated, injected and utilized in the scope of the configurable instance.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()
-
getInstances
Set<Object> 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:
getClasses()
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 15:05:00 Cette version de la page est en cache (à la date du 21/08/2025 15:05:00) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/ws/rs/core/Configuration.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.