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.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      DataContext copy()
      Create a deep copy
      java.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 context
      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
      default 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 context
      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
      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
      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.
      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 string
      default 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
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from interface com.dtolabs.rundeck.core.data.Mergable

        merge
    • 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 string
        failOnUnexpanded - 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 array
        converter - converter
        failIfUnexpanded - true to fail if property is not found
        blankIfUnexpanded - 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 name
        key - key name
        defaultValue - 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 string
        converter - converter to encode/convert the expanded values
        failOnUnexpanded - 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 string
        converter - converter to encode/convert the expanded values
        failOnUnexpanded - true to fail if a reference is not found
        blankIfUnexpanded - 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