Package org.apache.logging.log4j.util
Class PropertiesPropertySource
- java.lang.Object
-
- org.apache.logging.log4j.util.PropertiesPropertySource
-
- All Implemented Interfaces:
PropertySource
- Direct Known Subclasses:
PropertyFilePropertySource
public class PropertiesPropertySource extends java.lang.Object implements PropertySource
PropertySource backed by aPropertiesinstance. Normalized property names follow a scheme like this:Log4jContextSelectorwould normalize tolog4j2.contextSelector.- Since:
- 2.10.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.logging.log4j.util.PropertySource
PropertySource.Comparator, PropertySource.Util
-
-
Constructor Summary
Constructors Constructor Description PropertiesPropertySource(java.util.Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforEach(BiConsumer<java.lang.String,java.lang.String> action)Iterates over all properties and performs an action for each key/value pair.java.lang.CharSequencegetNormalForm(java.lang.Iterable<? extends java.lang.CharSequence> tokens)Converts a list of property name tokens into a normal form.intgetPriority()Returns the order in which this PropertySource has priority.
-
-
-
Method Detail
-
getPriority
public int getPriority()
Description copied from interface:PropertySourceReturns the order in which this PropertySource has priority. A higher value means that the source will be applied later so as to take precedence over other property sources.- Specified by:
getPriorityin interfacePropertySource- Returns:
- priority value
-
forEach
public void forEach(BiConsumer<java.lang.String,java.lang.String> action)
Description copied from interface:PropertySourceIterates over all properties and performs an action for each key/value pair.- Specified by:
forEachin interfacePropertySource- Parameters:
action- action to perform on each key/value pair
-
getNormalForm
public java.lang.CharSequence getNormalForm(java.lang.Iterable<? extends java.lang.CharSequence> tokens)
Description copied from interface:PropertySourceConverts a list of property name tokens into a normal form. For example, a list of tokens such as "foo", "bar", "baz", might be normalized into the property name "log4j2.fooBarBaz".- Specified by:
getNormalFormin interfacePropertySource- Parameters:
tokens- list of property name tokens- Returns:
- a normalized property name using the given tokens
-
-