public interface PropertiesComponent extends StaticService
Modifier and Type | Field and Description |
---|---|
static String |
FACTORY
Service factory key.
|
static String |
PREFIX_TOKEN
The prefix token.
|
static String |
SUFFIX_TOKEN
The suffix token.
|
Modifier and Type | Method and Description |
---|---|
void |
addLocation(String location)
Adds the list of locations to the current locations, where to load properties.
|
void |
addPropertiesFunction(PropertiesFunction function)
Registers the
PropertiesFunction as a function to this component. |
void |
addPropertiesSource(PropertiesSource propertiesSource)
Adds a custom
PropertiesSource to use as source for loading and/or looking up property values. |
Properties |
getLocalProperties()
Gets a list of properties that are local for the current thread only (ie thread local)
|
default Map<String,Object> |
getLocalPropertiesAsMap()
Gets a list of properties that are local for the current thread only (ie thread local)
|
List<String> |
getLocations()
Gets the configured properties locations.
|
Properties |
loadProperties()
Loads the properties from the default locations and sources.
|
Properties |
loadProperties(Predicate<String> filter)
Loads the properties from the default locations and sources filtering them out according to a predicate.
|
default Map<String,Object> |
loadPropertiesAsMap()
Loads the properties from the default locations and sources.
|
default Map<String,Object> |
loadPropertiesAsMap(Predicate<String> filter)
Loads the properties from the default locations and sources filtering them out according to a predicate.
|
String |
parseUri(String uri)
Parses the input text and resolve all property placeholders from within the text.
|
Optional<String> |
resolveProperty(String key)
Looks up the property with the given key
|
void |
setEncoding(String encoding)
Encoding to use when loading properties file from the file system or classpath.
|
void |
setIgnoreMissingLocation(boolean ignoreMissingLocation)
Whether to silently ignore if a location cannot be located, such as a properties file not found.
|
void |
setInitialProperties(Properties initialProperties)
Sets initial properties which will be added before any property locations are loaded.
|
void |
setLocalProperties(Properties localProperties)
Sets a special list of local properties (ie thread local) that take precedence and will use first, if a property
exist.
|
void |
setLocation(String location)
A list of locations to load properties.
|
void |
setOverrideProperties(Properties overrideProperties)
Sets a special list of override properties that take precedence and will use first, if a property exist.
|
static final String FACTORY
static final String PREFIX_TOKEN
static final String SUFFIX_TOKEN
String parseUri(String uri)
uri
- input textIllegalArgumentException
- is thrown if error during parsingOptional<String> resolveProperty(String key)
key
- the name of the propertyProperties loadProperties()
default Map<String,Object> loadPropertiesAsMap()
Map
representing the properties loaded.Properties loadProperties(Predicate<String> filter)
{ @code PropertiesComponent pc = getPropertiesComponent(); Properties props = pc.loadProperties(key -> key.startsWith("camel.component.seda")); }
filter
- the predicate used to filter out properties based on the key.default Map<String,Object> loadPropertiesAsMap(Predicate<String> filter)
{ @code PropertiesComponent pc = getPropertiesComponent(); Mapprops = pc.loadPropertiesAsMap(key -> key.startsWith("camel.component.seda")); }
filter
- the predicate used to filter out properties based on the key.Map
representing the properties loaded.List<String> getLocations()
PropertiesSource
.void setLocation(String location)
void addLocation(String location)
void addPropertiesSource(PropertiesSource propertiesSource)
PropertiesSource
to use as source for loading and/or looking up property values.void addPropertiesFunction(PropertiesFunction function)
PropertiesFunction
as a function to this component.void setIgnoreMissingLocation(boolean ignoreMissingLocation)
void setInitialProperties(Properties initialProperties)
void setOverrideProperties(Properties overrideProperties)
void setLocalProperties(Properties localProperties)
Properties getLocalProperties()
default Map<String,Object> getLocalPropertiesAsMap()
Map
representing the local properties.void setEncoding(String encoding)
Properties.load(java.io.InputStream)
Important you must set encoding before setting locations.Apache Camel