Package com.dtolabs.rundeck.core.data
Interface DataContext
-
- All Superinterfaces:
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>
,Mergable<DataContext>
- All Known Subinterfaces:
MutableDataContext
- All Known Implementing Classes:
BaseDataContext
public interface DataContext extends java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>, Mergable<DataContext>
Created by greg on 5/25/16.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description DataContext
copy()
Create a deep copyjava.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>
getData()
default DataContext
merged(DataContext other)
default java.lang.String
replaceDataReferences(java.lang.String input)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data contextdefault java.lang.String[]
replaceDataReferences(java.lang.String[] args)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data contextdefault java.lang.String[]
replaceDataReferences(java.lang.String[] args, Converter<java.lang.String,java.lang.String> converter, boolean failIfUnexpanded)
default java.lang.String[]
replaceDataReferences(java.lang.String[] args, Converter<java.lang.String,java.lang.String> converter, boolean failIfUnexpanded, boolean blankIfUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data contextdefault java.lang.String
replaceDataReferences(java.lang.String input, Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data contextdefault java.lang.String
replaceDataReferences(java.lang.String input, Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded, boolean blankIfUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data contextdefault java.util.Map<java.lang.String,java.lang.Object>
replaceDataReferences(java.util.Map<java.lang.String,java.lang.Object> input)
Recursively replace data references in the values in a map which contains either string, collection or Map values.default Converter<java.lang.String,java.lang.String>
replaceDataReferencesConverter()
default Converter<java.lang.String,java.lang.String>
replaceDataReferencesConverter(Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded)
Return a converter that can expand the property references within a stringdefault java.lang.String
resolve(java.lang.String group, java.lang.String key)
default java.lang.String
resolve(java.lang.String group, java.lang.String key, java.lang.String defaultValue)
Return the resolved value from the context
-
-
-
Method Detail
-
getData
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getData()
-
replaceDataReferencesConverter
default Converter<java.lang.String,java.lang.String> replaceDataReferencesConverter()
-
copy
DataContext copy()
Create a deep copy- Returns:
- a new object
-
replaceDataReferencesConverter
default Converter<java.lang.String,java.lang.String> replaceDataReferencesConverter(Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded)
Return a converter that can expand the property references within a string- Parameters:
converter
- secondary converter to apply to property values before replacing in a stringfailOnUnexpanded
- if true, fail if a property value cannot be expanded- Returns:
- a Converter to expand property values within a string
-
replaceDataReferences
default java.lang.String[] replaceDataReferences(java.lang.String[] args, Converter<java.lang.String,java.lang.String> converter, boolean failIfUnexpanded)
-
replaceDataReferences
default java.lang.String[] replaceDataReferences(java.lang.String[] args, Converter<java.lang.String,java.lang.String> converter, boolean failIfUnexpanded, boolean blankIfUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context- Parameters:
args
- argument string arrayconverter
- converterfailIfUnexpanded
- true to fail if property is not foundblankIfUnexpanded
- true to use blank if property is not found- Returns:
- string array with replaced embedded properties
-
replaceDataReferences
default java.lang.String[] replaceDataReferences(java.lang.String[] args)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context- Parameters:
args
- argument string array- Returns:
- string array with replaced embedded properties
-
replaceDataReferences
default java.util.Map<java.lang.String,java.lang.Object> replaceDataReferences(java.util.Map<java.lang.String,java.lang.Object> input)
Recursively replace data references in the values in a map which contains either string, collection or Map values.- Parameters:
input
- input map- Returns:
- Map with all string values having references replaced
-
resolve
default java.lang.String resolve(java.lang.String group, java.lang.String key)
-
resolve
default java.lang.String resolve(java.lang.String group, java.lang.String key, java.lang.String defaultValue)
Return the resolved value from the context- Parameters:
group
- group namekey
- key namedefaultValue
- default if the value is not resolvable- Returns:
- resolved value or default
-
replaceDataReferences
default java.lang.String replaceDataReferences(java.lang.String input)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context- Parameters:
input
- input string- Returns:
- string with values substituted, or original string
-
replaceDataReferences
default java.lang.String replaceDataReferences(java.lang.String input, Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context- Parameters:
input
- input stringconverter
- converter to encode/convert the expanded valuesfailOnUnexpanded
- true to fail if a reference is not found- Returns:
- string with values substituted, or original string
-
replaceDataReferences
default java.lang.String replaceDataReferences(java.lang.String input, Converter<java.lang.String,java.lang.String> converter, boolean failOnUnexpanded, boolean blankIfUnexpanded)
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context- Parameters:
input
- input stringconverter
- converter to encode/convert the expanded valuesfailOnUnexpanded
- true to fail if a reference is not foundblankIfUnexpanded
- true to use blank if a reference is not found- Returns:
- string with values substituted, or original string
-
merged
default DataContext merged(DataContext other)
- Parameters:
other
-- Returns:
- new data context of this context merged with the other context
-
-