Package io.deephaven.configuration
Class ParsedProperties
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
Class for reading in a customized properties file, applying only the locally-relevant properties and keeping track of
which properties may not be further modified. Maintains the ordering of the properties from the input file.
- See Also:
-
Field Summary
Fields inherited from class java.util.Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionA constructor that starts with no existing scoped or final properties.ParsedProperties(boolean ignoreScopes) A constructor that starts with no existing scoped or final properties.ParsedProperties(boolean ignoreScopes, @NotNull ConfigurationContext context) A constructor that starts with no existing scoped or final properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleanbooleancontainsKey(Object key) booleancontainsValue(Object value) elements()@NotNull SetentrySet()booleanA mapping from each property name to the file and location where the property came from.getProperty(String key) booleanisEmpty()keys()@NotNull SetkeySet()voidlist(PrintStream out) voidlist(PrintWriter out) voidload(InputStream stream) Load the properties from the specified InputStream, ignoring any directives that do not match the current context.voidLoad the properties from the specified file, ignoring any directives that do not match the current context.Determine whether a property is final or not, and only allow the update if it is not already final.voidRemove a non-final property from the collection.setProperty(String key, String value) Determine whether a property is final or not, and only allow the update if it is not already final.intsize()@NotNull Collectionvalues()Methods inherited from class java.util.Properties
clone, compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, getProperty, hashCode, load, loadFromXML, merge, propertyNames, putIfAbsent, rehash, remove, replace, replace, replaceAll, save, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString
-
Constructor Details
-
ParsedProperties
public ParsedProperties()A constructor that starts with no existing scoped or final properties. -
ParsedProperties
public ParsedProperties(boolean ignoreScopes) A constructor that starts with no existing scoped or final properties.- Parameters:
ignoreScopes- True if this parser should ignore scope restrictions, false otherwise. Used by the PropertyInspector when checking whether required or disallowed properties are present.
-
ParsedProperties
A constructor that starts with no existing scoped or final properties.- Parameters:
ignoreScopes- True if this parser should ignore scope restrictions, false otherwise. Used by the PropertyInspector when checking whether required or disallowed properties are present.context- theConfigurationContextfor determining environment settings
-
-
Method Details
-
getLineNumbers
A mapping from each property name to the file and location where the property came from. This is public so that we can use this in a property inspector to get the full story about what properties exist and where those properties were defined.- Returns:
- The current map
-
putAll
-
clear
public void clear() -
contains
- Overrides:
containsin classProperties
-
containsKey
- Specified by:
containsKeyin interfaceMap<Object,Object> - Overrides:
containsKeyin classProperties
-
containsValue
- Specified by:
containsValuein interfaceMap<Object,Object> - Overrides:
containsValuein classProperties
-
elements
- Overrides:
elementsin classProperties
-
entrySet
-
equals
-
get
-
getProperty
- Overrides:
getPropertyin classProperties
-
isEmpty
public boolean isEmpty() -
keys
- Overrides:
keysin classProperties
-
keySet
-
list
- Overrides:
listin classProperties
-
list
- Overrides:
listin classProperties
-
size
public int size() -
values
-
load
Load the properties from the specified InputStream, ignoring any directives that do not match the current context. Automatically closes the stream when the last line has been processed.- Overrides:
loadin classProperties- Parameters:
stream- The open stream providing a view into the data to be parsed.- Throws:
IOException- If the stream cannot be read at some point.
-
put
Determine whether a property is final or not, and only allow the update if it is not already final. -
remove
Remove a non-final property from the collection. Attempting to remove a final property will cause a ConfigurationException to be thrown. -
setProperty
Determine whether a property is final or not, and only allow the update if it is not already final. This should not be called from within the load operation for this class.- Overrides:
setPropertyin classProperties- Parameters:
key- The name of the property to set a value for.value- The value of the property being set.- Returns:
- The previous value of the property being set, or null if it had no previous value.
-
load
Load the properties from the specified file, ignoring any directives that do not match the current context. Directories may be specified, including relative paths, but the '~' operator is not supported.Loads the fileName via
PropertyInputStreamLoader.- Parameters:
fileName- The resource or file to load.- Throws:
IOException- if the property stream cannot be processedConfigurationException- if the property stream cannot be opened
-