public class MapPropertySource extends BasePropertySource
EMPTY, TAMAYA_ORDINAL
Constructor and Description |
---|
MapPropertySource(String name,
Map<String,String> props)
Creates a new instance, hereby using the default mechanism for evaluating the property source's
priority.
|
MapPropertySource(String name,
Map<String,String> props,
String rootContext)
Creates a new instance, hereby using the default mechanism for evaluating the property source's
priority, but applying a custom mapping
rootContext to the entries provided. |
MapPropertySource(String name,
Map<String,String> props,
String rootContext,
Integer priority)
Creates a new instance, hereby using the default mechanism for evaluating the property source's
priority, but applying a custom mapping
rootContext to the entries provided. |
MapPropertySource(String name,
Properties props,
String rootContext,
Integer priority)
Creates a new instance, hereby using the default mechanism for evaluating the property source's
priority, but applying a custom mapping
rootContext to the entries provided. |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
getMap(Properties props)
Simple method to convert Properties into a Map instance.
|
String |
getName()
Get the name of the property source.
|
int |
getOrdinal()
Lookup order:
TODO rethink whole default PropertySources and ordering:
TODO introduce default values or constants for ordinals
System properties (ordinal 400)
Environment properties (ordinal 300)
JNDI values (ordinal 200)
Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)
Important Hints for custom implementations:
If a custom implementation should be invoked before the default implementations, use a value > 400
If a custom implementation should be invoked after the default implementations, use a value < 100
Reordering of the default order of the config-sources:
Example: If the properties file/s should be used before the other implementations,
you have to configure an ordinal > 400.
|
Map<String,String> |
getProperties()
Access the current properties as Map.
|
String |
toString() |
get, getDefaultOrdinal, isScannable
public MapPropertySource(String name, Map<String,String> props)
name
- unique name of this source.props
- the propertiespublic MapPropertySource(String name, Map<String,String> props, String rootContext)
rootContext
to the entries provided.name
- unique name of this source.props
- the propertiesrootContext
- the root context mapping, or null (for no mapping).public MapPropertySource(String name, Map<String,String> props, String rootContext, Integer priority)
rootContext
to the entries provided.name
- unique name of this source.props
- the propertiesrootContext
- the root context mapping, or null (for no mapping).priority
- the (optional) fixed priority. If null, the default priority
evaluation is used.public MapPropertySource(String name, Properties props, String rootContext, Integer priority)
rootContext
to the entries provided.name
- unique name of this source.props
- the propertiesrootContext
- the root context mapping, or null (for no mapping).priority
- the (optional) fixed priority. If null, the default priority
evaluation is used.public static Map<String,String> getMap(Properties props)
props
- the properties, not null.public String getName()
PropertySource
getName
in interface PropertySource
getName
in class BasePropertySource
public Map<String,String> getProperties()
PropertySource
public int getOrdinal()
PropertySource
Important Hints for custom implementations:
If a custom implementation should be invoked before the default implementations, use a value > 400
If a custom implementation should be invoked after the default implementations, use a value < 100
Reordering of the default order of the config-sources:
Example: If the properties file/s should be used before the other implementations, you have to configure an ordinal > 400. That means, you have to add e.g. deltaspike_ordinal=401 to /META-INF/apache-deltaspike.properties . Hint: In case of property files every file is handled as independent config-source, but all of them have ordinal 400 by default (and can be reordered in a fine-grained manner.
getOrdinal
in interface PropertySource
getOrdinal
in class BasePropertySource
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.