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
AnOrderedPropertiesthat 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()voidclear()protected ObjectdoPut(String key, String value)Set<Map.Entry<Object,Object>>entrySet()Objectget(Object key)ObjectgetDefaultValue(Object key)Gets the default value of the property, if a default value existsStringgetLocation(Object key)Gets the location from where the property was resolvedStringgetProperty(String key)StringgetProperty(String key, String defaultValue)booleanisEmpty()Enumeration<Object>keys()Set<Object>keySet()Objectput(Object key, Object value)voidput(String location, Object key, Object value)voidput(String location, Object key, Object value, Object defaultValue)voidputAll(String location, Map<Object,Object> map)voidputAll(String location, Properties properties)voidputAll(Map<?,?> t)voidputAll(OrderedLocationProperties other)Objectremove(Object key)intsize()Set<String>stringPropertyNames()StringtoString()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:
getPropertyin classProperties
-
getProperty
public String getProperty(String key, String defaultValue)
- Overrides:
getPropertyin classProperties
-
keys
public Enumeration<Object> keys()
- Overrides:
keysin classProperties
-
size
public int size()
-
stringPropertyNames
public Set<String> stringPropertyNames()
- Overrides:
stringPropertyNamesin classProperties
-
values
public Collection<Object> values()
-
toString
public String toString()
- Overrides:
toStringin classProperties
-
-