public class PropertiesPropertySource extends Object implements PropertySource
Properties
instance. Normalized property names follow a scheme like this:
Log4jContextSelector
would normalize to log4j2.contextSelector
.PropertySource.Comparator, PropertySource.Util
Constructor and Description |
---|
PropertiesPropertySource(Properties properties) |
PropertiesPropertySource(Properties properties,
int priority) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(String key)
For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.
|
void |
forEach(BiConsumer<String,String> action)
Iterates over all properties and performs an action for each key/value pair.
|
CharSequence |
getNormalForm(Iterable<? extends CharSequence> tokens)
Converts a list of property name tokens into a normal form.
|
int |
getPriority()
Returns the order in which this PropertySource has priority.
|
String |
getProperty(String key)
For PropertySources that cannot iterate over all the potential properties this provides a direct lookup.
|
Collection<String> |
getPropertyNames()
Returns the list of all property names.
|
public PropertiesPropertySource(Properties properties)
public PropertiesPropertySource(Properties properties, int priority)
public int getPriority()
PropertySource
getPriority
in interface PropertySource
public void forEach(BiConsumer<String,String> action)
PropertySource
forEach
in interface PropertySource
action
- action to perform on each key/value pairpublic CharSequence getNormalForm(Iterable<? extends CharSequence> tokens)
PropertySource
getNormalForm
in interface PropertySource
tokens
- list of property name tokenspublic Collection<String> getPropertyNames()
PropertySource
getPropertyNames
in interface PropertySource
public String getProperty(String key)
PropertySource
getProperty
in interface PropertySource
key
- The key to search for.public boolean containsProperty(String key)
PropertySource
containsProperty
in interface PropertySource
key
- The key to search for. Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.