Top Description Methods
javax.ws.rs.core

public Interface Configuration

Imports
java.util.Collection, .Map, .Set, javax.ws.rs.RuntimeType

A configuration state associated with a 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. javax.ws.rs.client.Client, javax.ws.rs.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.

Author
Marek Potociar
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public Set<Class<?>>

Returns:

the immutable set of registered JAX-RS component classes. The returned value may be empty but will never be null.
getClasses
()

Get the immutable set of registered JAX-RS component (such as provider or feature) classes to be instantiated, injected and utilized in the scope of the configurable instance.

public Map<Class<?>, Integer>

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.
getContracts
(Class<?> componentClass)

Get the extension contract registration information for a component of a given class.

public Set<Object>

Returns:

the immutable set of registered JAX-RS component instances. The returned value may be empty but will never be null.
getInstances
()

Get the immutable set of registered JAX-RS component (such as provider or feature) instances to be utilized by the configurable instance.

public Map<String, Object>

Returns:

the immutable view of configuration properties.
getProperties
()

Get the immutable bag of configuration properties.

public Object

Returns:

the property value for the specified property name or null if the property with such name is not configured.
getProperty
(String
property name.
name
)

Get the value for the property with a given name.

public Collection<String>

Returns:

an immutable collection of property names.
getPropertyNames
()

Returns an immutable collection containing the property names available within the context of the current configuration instance.

public RuntimeType

Returns:

configuration context runtime type.
getRuntimeType
()

Get the runtime type of this configuration context.

public boolean

Returns:

true if the feature instance has been previously enabled in this configuration context, false otherwise.
isEnabled
(Feature
a feature instance to test for.
feature
)

Check if a particular feature instance has been previously enabled in the runtime configuration context.

public boolean

Returns:

true if a feature of a given class has been previously enabled in this configuration context, false otherwise.
isEnabled
(Class<? extends Feature>
a feature class to test for.
featureClass
)

Check if a feature instance of featureClass class has been previously enabled in the runtime configuration context.

public boolean

Returns:

true if the component instance has been previously registered in this configuration context, false otherwise.
isRegistered
(Object
a component instance to test for.
component
)

Check if a particular JAX-RS component instance (such as providers or features) has been previously registered in the runtime configuration context.

public boolean

Returns:

true if a component of a given class has been previously registered in this configuration context, false otherwise.
isRegistered
(Class<?>
a component class to test for.
componentClass
)

Check if a JAX-RS component of the supplied componentClass class has been previously registered in the runtime configuration context.

Method Detail

getClassesback to summary
public Set<Class<?>> getClasses()

Get the immutable set of registered JAX-RS component (such as provider or feature) 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:Set<Class<?>>

the immutable set of registered JAX-RS component classes. The returned value may be empty but will never be null.

See Also
getInstances
getContractsback to summary
public 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 empty Map. Method does not return null.

Returns:Map<Class<?>, Integer>

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.

getInstancesback to summary
public Set<Object> getInstances()

Get the immutable set of registered JAX-RS component (such as provider or feature) instances to be utilized by the configurable instance. Fields and properties of returned instances are injected with their declared dependencies (see Context) 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:Set<Object>

the immutable set of registered JAX-RS component instances. The returned value may be empty but will never be null.

See Also
getClasses
getPropertiesback to summary
public Map<String, Object> getProperties()

Get the immutable bag of configuration properties.

Returns:Map<String, Object>

the immutable view of configuration properties.

getPropertyback to summary
public Object getProperty(String name)

Get the value for the property with a given name.

Parameters
name:String

property name.

Returns:Object

the property value for the specified property name or null if the property with such name is not configured.

getPropertyNamesback to summary
public Collection<String> getPropertyNames()

Returns an immutable collection containing the property names available within the context of the current configuration instance.

Use the getProperty method with a property name to get the value of a property.

Returns:Collection<String>

an immutable collection of property names.

See Also
getProperty
getRuntimeTypeback to summary
public RuntimeType getRuntimeType()

Get the runtime type of this configuration context.

Returns:RuntimeType

configuration context runtime type.

isEnabledback to summary
public boolean isEnabled(Feature feature)

Check if a particular feature instance has been previously enabled in the runtime configuration context.

Method returns true only in case an instance equal to the feature instance is already present among the features previously successfully enabled in the configuration context.

Parameters
feature:Feature

a feature instance to test for.

Returns:boolean

true if the feature instance has been previously enabled in this configuration context, false otherwise.

isEnabledback to summary
public boolean isEnabled(Class<? extends Feature> featureClass)

Check if a feature instance of featureClass class has been previously enabled in the runtime configuration context.

Method returns true in case any instance of the featureClass class is already present among the features previously successfully enabled in the configuration context.

Parameters
featureClass:Class<? extends Feature>

a feature class to test for.

Returns:boolean

true if a feature of a given class has been previously enabled in this configuration context, false otherwise.

isRegisteredback to summary
public boolean isRegistered(Object component)

Check if a particular JAX-RS component instance (such as providers or features) has been previously registered in the runtime configuration context.

Method returns true only in case an instance equal to the component instance is already present among the components previously registered in the configuration context.

Parameters
component:Object

a component instance to test for.

Returns:boolean

true if the component instance has been previously registered in this configuration context, false otherwise.

See Also
isEnabled(Feature)
isRegisteredback to summary
public boolean isRegistered(Class<?> componentClass)

Check if a JAX-RS component of the supplied componentClass class has been previously registered in the runtime configuration context.

Method returns true in case a component of the supplied componentClass class is already present among the previously registered component classes or instances in the configuration context.

Parameters
componentClass:Class<?>

a component class to test for.

Returns:boolean

true if a component of a given class has been previously registered in this configuration context, false otherwise.

See Also
isEnabled(Class)