Package org.apache.logging.log4j.util
Interface PropertySource
-
- All Known Implementing Classes:
EnvironmentPropertySource,PropertiesPropertySource,PropertyFilePropertySource,SystemPropertiesPropertySource
public interface PropertySourceA source for global configuration properties.- Since:
- 2.10.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPropertySource.ComparatorComparator for ordering PropertySource instances by priority.static classPropertySource.UtilUtility methods useful for PropertySource implementations.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancontainsProperty(java.lang.String key)For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.default voidforEach(BiConsumer<java.lang.String,java.lang.String> action)Iterates over all properties and performs an action for each key/value pair.default 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.default java.lang.StringgetProperty(java.lang.String key)For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.default java.util.Collection<java.lang.String>getPropertyNames()Returns the list of all property names.
-
-
-
Method Detail
-
getPriority
int getPriority()
Returns the order in which this PropertySource has priority. A higher value means that the source will be searched later and can be overridden by other property sources.- Returns:
- priority value
-
forEach
default void forEach(BiConsumer<java.lang.String,java.lang.String> action)
Iterates over all properties and performs an action for each key/value pair.- Parameters:
action- action to perform on each key/value pair
-
getPropertyNames
default java.util.Collection<java.lang.String> getPropertyNames()
Returns the list of all property names.- Returns:
- list of property names
-
getNormalForm
default java.lang.CharSequence getNormalForm(java.lang.Iterable<? extends java.lang.CharSequence> tokens)
Converts 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".- Parameters:
tokens- list of property name tokens- Returns:
- a normalized property name using the given tokens
-
getProperty
default java.lang.String getProperty(java.lang.String key)
For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.- Parameters:
key- The key to search for.- Returns:
- The value or null;
- Since:
- 2.13.0
-
containsProperty
default boolean containsProperty(java.lang.String key)
For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.- Parameters:
key- The key to search for.- Returns:
- The value or null;
- Since:
- 2.13.0
-
-