Class SystemPropertiesConfigurationModel
- java.lang.Object
-
- org.glassfish.jersey.internal.config.SystemPropertiesConfigurationModel
-
- All Implemented Interfaces:
Configuration,ExtendedConfig,ExternalConfigurationModel<Void>
public class SystemPropertiesConfigurationModel extends Object implements ExternalConfigurationModel<Void>
The External Configuration Model that supportsSystemproperties. The properties are listed in a property class in a form ofpublic static final Stringproperty name. TheStringvalue of the property name is searched among theSystemproperties. The property scan is performed only whenCommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDERis set totrue.
-
-
Constructor Summary
Constructors Constructor Description SystemPropertiesConfigurationModel(List<String> propertyClassNames)Create newExternalConfigurationModelfor properties defined by classes inpropertyClassNameslist.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(String name, Class<T> clazz)Get value of a property as a definite type property shall exist in order for this method to be used.Set<Class<?>>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.VoidgetConfig()Obtain config objectMap<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.<T> Optional<T>getOptionalProperty(String name, Class<T> clazz)Get value of a property as a definite type property may not exist, an empty Optional object is returned in case of an empty propertyMap<String,Object>getProperties()Get the immutable bag of configuration properties.ObjectgetProperty(String name)Get the value for the property with a given name.protected List<String>getPropertyClassNames()Collection<String>getPropertyNames()Returns an immutablecollectioncontaining the property names available within the context of the current configuration instance.RuntimeTypegetRuntimeType()Get the runtime type of this configuration context.booleanisEnabled(Feature feature)Check if a particularfeatureinstance has been previously enabled in the runtime configuration context.booleanisEnabled(Class<? extends Feature> featureClass)Check if afeatureinstance offeatureClassclass has been previously enabled in the runtime configuration context.booleanisProperty(String name)Get the value of the property with a given name converted toboolean.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.ExternalConfigurationModelmergeProperties(Map<String,Object> inputProperties)Merge properties from other (found) external configuration.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.ws.rs.core.Configuration
hasProperty
-
-
-
-
Constructor Detail
-
SystemPropertiesConfigurationModel
public SystemPropertiesConfigurationModel(List<String> propertyClassNames)
Create newExternalConfigurationModelfor properties defined by classes inpropertyClassNameslist.- Parameters:
propertyClassNames- List of property defining class names.
-
-
Method Detail
-
as
public <T> T as(String name, Class<T> clazz)
Description copied from interface:ExternalConfigurationModelGet value of a property as a definite type property shall exist in order for this method to be used. Otherwise exception is thrown- Specified by:
asin interfaceExternalConfigurationModel<Void>- Type Parameters:
T- type of an expected value- Parameters:
name- property nameclazz- class type of an expected value- Returns:
- value of an expected type
-
getOptionalProperty
public <T> Optional<T> getOptionalProperty(String name, Class<T> clazz)
Description copied from interface:ExternalConfigurationModelGet value of a property as a definite type property may not exist, an empty Optional object is returned in case of an empty property- Specified by:
getOptionalPropertyin interfaceExternalConfigurationModel<Void>- Type Parameters:
T- type of an expected value- Parameters:
name- property nameclazz- class type of an expected value- Returns:
- Optional object filled by a value of an expected type or by the NULL value (
-
mergeProperties
public ExternalConfigurationModel mergeProperties(Map<String,Object> inputProperties)
Description copied from interface:ExternalConfigurationModelMerge properties from other (found) external configuration.- Specified by:
mergePropertiesin interfaceExternalConfigurationModel<Void>- Parameters:
inputProperties- those properties will be merged into ours- Returns:
- current instance of the model
-
getConfig
public Void getConfig()
Description copied from interface:ExternalConfigurationModelObtain config object- Specified by:
getConfigin interfaceExternalConfigurationModel<Void>- Returns:
- external config provider
-
isProperty
public boolean isProperty(String name)
Description copied from interface:ExtendedConfigGet the value of the property with a given name converted toboolean. Returnsfalseif the value is not convertible.- Specified by:
isPropertyin interfaceExtendedConfig- Parameters:
name- property name.- Returns:
booleanproperty value orfalseif the property is not convertible.
-
getRuntimeType
public RuntimeType getRuntimeType()
Description copied from interface:ConfigurationGet the runtime type of this configuration context.- Specified by:
getRuntimeTypein interfaceConfiguration- Returns:
- configuration context runtime type.
-
getProperties
public Map<String,Object> getProperties()
Description copied from interface:ConfigurationGet the immutable bag of configuration properties.- Specified by:
getPropertiesin interfaceConfiguration- Returns:
- the immutable view of configuration properties.
-
getProperty
public Object getProperty(String name)
Description copied from interface:ConfigurationGet the value for the property with a given name.- Specified by:
getPropertyin interfaceConfiguration- Parameters:
name- property name.- Returns:
- the property value for the specified property name or
nullif the property with such name is not configured.
-
getPropertyNames
public Collection<String> getPropertyNames()
Description copied from interface:ConfigurationReturns an immutablecollectioncontaining the property names available within the context of the current configuration instance.Use the
Configuration.getProperty(java.lang.String)method with a property name to get the value of a property.- Specified by:
getPropertyNamesin interfaceConfiguration- Returns:
- an immutable
collectionof property names. - See Also:
Configuration.getProperty(java.lang.String)
-
isEnabled
public boolean isEnabled(Feature feature)
Description copied from interface:ConfigurationCheck 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.- Specified by:
isEnabledin interfaceConfiguration- Parameters:
feature- a feature instance to test for.- Returns:
trueif the feature instance has been previously enabled in this configuration context,falseotherwise.
-
isEnabled
public boolean isEnabled(Class<? extends Feature> featureClass)
Description copied from interface:ConfigurationCheck 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.- Specified by:
isEnabledin interfaceConfiguration- 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
public boolean isRegistered(Object component)
Description copied from interface:ConfigurationCheck 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.- Specified by:
isRegisteredin interfaceConfiguration- Parameters:
component- a component instance to test for.- Returns:
trueif the component instance has been previously registered in this configuration context,falseotherwise.- See Also:
Configuration.isEnabled(Feature)
-
isRegistered
public boolean isRegistered(Class<?> componentClass)
Description copied from interface:ConfigurationCheck 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.- Specified by:
isRegisteredin interfaceConfiguration- 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:
Configuration.isEnabled(Class)
-
getContracts
public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
Description copied from interface:ConfigurationGet 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.- Specified by:
getContractsin interfaceConfiguration- 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
public Set<Class<?>> getClasses()
Description copied from interface:ConfigurationGet 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.
- Specified by:
getClassesin interfaceConfiguration- Returns:
- the immutable set of registered JAX-RS component classes. The returned value may be empty but will never be
null. - See Also:
Configuration.getInstances()
-
getInstances
public Set<Object> getInstances()
Description copied from interface:ConfigurationGet 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.
- Specified by:
getInstancesin interfaceConfiguration- Returns:
- the immutable set of registered JAX-RS component instances. The returned value may be empty but will never be
null. - See Also:
Configuration.getClasses()
-
-