public class SystemPropertiesConfigurationModel extends Object implements ExternalConfigurationModel<Void>
System
properties. The properties are listed in a property class
in a form of public static final String
property name. The String
value of the property name is searched
among the System
properties. The property scan is performed only when
CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER
is set to true
.Constructor and Description |
---|
SystemPropertiesConfigurationModel(List<String> propertyClassNames)
Create new
ExternalConfigurationModel for properties defined by classes in propertyClassNames list. |
Modifier and Type | Method and Description |
---|---|
<T> T |
as(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 or
feature )
classes to be instantiated, injected and utilized in the scope of the configurable instance. |
Void |
getConfig()
Obtain config object
|
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 or
feature ) 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 property
|
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.
|
protected List<String> |
getPropertyClassNames() |
Collection<String> |
getPropertyNames()
Returns an immutable
collection 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 a
feature instance of featureClass class has been previously enabled in the runtime
configuration context. |
boolean |
isEnabled(Feature feature)
Check if a particular
feature instance has been previously enabled in the runtime configuration
context. |
boolean |
isProperty(String name)
Get the value of the property with a given name converted to
boolean . |
boolean |
isRegistered(Class<?> componentClass)
Check if a JAX-RS component of the supplied
componentClass class has been previously registered in the
runtime configuration context. |
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. |
ExternalConfigurationModel |
mergeProperties(Map<String,Object> inputProperties)
Merge properties from other (found) external configuration.
|
public SystemPropertiesConfigurationModel(List<String> propertyClassNames)
ExternalConfigurationModel
for properties defined by classes in propertyClassNames
list.propertyClassNames
- List of property defining class names.public <T> T as(String name, Class<T> clazz)
ExternalConfigurationModel
as
in interface ExternalConfigurationModel<Void>
T
- type of an expected valuename
- property nameclazz
- class type of an expected valuepublic <T> Optional<T> getOptionalProperty(String name, Class<T> clazz)
ExternalConfigurationModel
getOptionalProperty
in interface ExternalConfigurationModel<Void>
T
- type of an expected valuename
- property nameclazz
- class type of an expected valuepublic ExternalConfigurationModel mergeProperties(Map<String,Object> inputProperties)
ExternalConfigurationModel
mergeProperties
in interface ExternalConfigurationModel<Void>
inputProperties
- those properties will be merged into ourspublic Void getConfig()
ExternalConfigurationModel
getConfig
in interface ExternalConfigurationModel<Void>
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 RuntimeType getRuntimeType()
Configuration
getRuntimeType
in interface Configuration
public Map<String,Object> getProperties()
Configuration
getProperties
in interface Configuration
public Object getProperty(String name)
Configuration
getProperty
in interface Configuration
name
- property name.null
if the property with such name is not
configured.public Collection<String> getPropertyNames()
Configuration
collection
containing 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.
getPropertyNames
in interface Configuration
collection
of property names.Configuration.getProperty(java.lang.String)
public boolean isEnabled(Feature feature)
Configuration
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.
isEnabled
in interface Configuration
feature
- a feature instance to test for.true
if the feature instance has been previously enabled in this configuration context, false
otherwise.public boolean isEnabled(Class<? extends Feature> featureClass)
Configuration
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.
isEnabled
in interface Configuration
featureClass
- a feature class to test for.true
if a feature of a given class has been previously enabled in this configuration context,
false
otherwise.public boolean isRegistered(Object component)
Configuration
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.
isRegistered
in interface Configuration
component
- a component instance to test for.true
if the component instance has been previously registered in this configuration context,
false
otherwise.Configuration.isEnabled(Feature)
public boolean isRegistered(Class<?> componentClass)
Configuration
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.
isRegistered
in interface Configuration
componentClass
- a component class to test for.true
if a component of a given class has been previously registered in this configuration context,
false
otherwise.Configuration.isEnabled(Class)
public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
Configuration
Map
.
Method does not return null
.getContracts
in interface Configuration
componentClass
- a component class for which to get contracts.public Set<Class<?>> getClasses()
Configuration
feature
)
classes to be instantiated, injected and utilized in the scope of the configurable instance. In contrast to
Application.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.
getClasses
in interface Configuration
null
.Configuration.getInstances()
public Set<Object> getInstances()
Configuration
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.
getInstances
in interface Configuration
null
.Configuration.getClasses()
Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.