Package org.apache.camel.util
Class OrderedLocationProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- org.apache.camel.util.OrderedLocationProperties
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,Object>
public final class OrderedLocationProperties extends Properties
AnOrderedProperties
that also keeps track from which location the properties are sourced from, and default values. This can be used to track all the various sources for configuration that a Camel application uses (properties file, ENV variables, hardcoded in java, spring-boot, quarkus, camel-k modeline, camel-yaml-dsl etc. Important: Use the put method that takes location as argument to store location information, and the put method that takes default value as argument to store default value information.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description OrderedLocationProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
asMap()
void
clear()
protected Object
doPut(String key, String value)
Set<Map.Entry<Object,Object>>
entrySet()
Object
get(Object key)
Object
getDefaultValue(Object key)
Gets the default value of the property, if a default value existsString
getLocation(Object key)
Gets the location from where the property was resolvedString
getProperty(String key)
String
getProperty(String key, String defaultValue)
boolean
isEmpty()
Enumeration<Object>
keys()
Set<Object>
keySet()
Object
put(Object key, Object value)
void
put(String location, Object key, Object value)
void
put(String location, Object key, Object value, Object defaultValue)
void
putAll(String location, Map<Object,Object> map)
void
putAll(String location, Properties properties)
void
putAll(Map<?,?> t)
void
putAll(OrderedLocationProperties other)
Object
remove(Object key)
int
size()
Set<String>
stringPropertyNames()
String
toString()
Collection<Object>
values()
-
Methods inherited from class java.util.Properties
clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, equals, forEach, getOrDefault, hashCode, list, list, load, load, loadFromXML, merge, propertyNames, putIfAbsent, rehash, remove, replace, replace, replaceAll, save, setProperty, store, store, storeToXML, storeToXML, storeToXML
-
-
-
-
Constructor Detail
-
OrderedLocationProperties
public OrderedLocationProperties()
-
-
Method Detail
-
putAll
public void putAll(OrderedLocationProperties other)
-
putAll
public void putAll(String location, Properties properties)
-
getLocation
public String getLocation(Object key)
Gets the location from where the property was resolved- Parameters:
key
- the property key- Returns:
- the location, or null if not possible to determine the location.
-
getDefaultValue
public Object getDefaultValue(Object key)
Gets the default value of the property, if a default value exists- Parameters:
key
- the property key- Returns:
- the default value, or null if not possible to determine the default value.
-
putAll
public void putAll(Map<?,?> t)
-
isEmpty
public boolean isEmpty()
-
getProperty
public String getProperty(String key)
- Overrides:
getProperty
in classProperties
-
getProperty
public String getProperty(String key, String defaultValue)
- Overrides:
getProperty
in classProperties
-
keys
public Enumeration<Object> keys()
- Overrides:
keys
in classProperties
-
size
public int size()
-
stringPropertyNames
public Set<String> stringPropertyNames()
- Overrides:
stringPropertyNames
in classProperties
-
values
public Collection<Object> values()
-
toString
public String toString()
- Overrides:
toString
in classProperties
-
-