Interface DataFixer

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DataFixer
Defines a function for mutating and upgrading serialized structures.
  • Method Details

    • fix

      <D> D fix(DynamicOps<D> ops, D input)
      Applies the required data transformation logic utilizing dynamic operations.
      Type Parameters:
      D - The target serialization format type.
      Parameters:
      ops - The dynamic operations logic used to navigate data.
      input - The current data payload to mutate.
      Returns:
      The mutated, upgraded serialized data.
    • compose

      static DataFixer compose(DataFixer... fixers)
      Chains sequential data fixers together in execution order.
      Parameters:
      fixers - Varargs array of fixers to run in sequence.
      Returns:
      A consolidated DataFixer handling the entire chain.
    • mapTransform

      static DataFixer mapTransform(DataFixer.MapTransformer transformer)
      Executes a structural logic transformation on a data node representing a map.
      Parameters:
      transformer - The logic defining map modifications.
      Returns:
      A DataFixer encapsulating the map transform task.
    • listTransform

      static DataFixer listTransform(DataFixer.ListTransformer transformer)
      Executes a structural logic transformation on a data node representing a list.
      Parameters:
      transformer - The logic defining list modifications.
      Returns:
      A DataFixer encapsulating the list transform task.
    • path

      static DataFixer path(String path, DataFixer fixer)
      Translates a nested path expression into a sequence of modifications down the tree structure.
      Parameters:
      path - The literal target nested segment using the compiled DataPath syntax.
      fixer - The isolated logic running at the resolved path destination.
      Returns:
      A DataFixer managing nested traversal constraints.
    • renameKey

      static DataFixer renameKey(String oldKey, String newKey)
      Replaces a specific map key with a new identifier.
      Parameters:
      oldKey - The current identifier.
      newKey - The target identifier to use moving forward.
      Returns:
      A DataFixer executing the rename map transform.
    • removeKey

      static DataFixer removeKey(String key)
      Deletes a specific key entirely from the map structure.
      Parameters:
      key - The identifier to remove.
      Returns:
      A DataFixer executing the removal map transform.
    • transformValue

      static DataFixer transformValue(String key, DataFixer valueFixer)
      Recursively passes a specific map entry's value to a secondary fixer logic.
      Parameters:
      key - The map key housing the nested structure to fix.
      valueFixer - The sub-fixer to execute against the nested data.
      Returns:
      A DataFixer executing the conditional map transform.
    • hoistKey

      static DataFixer hoistKey(String nestedMapKey, String keyToHoist)
      Elevates a deeply nested map key up to the parent map execution level.
      Parameters:
      nestedMapKey - The parent housing the current key.
      keyToHoist - The key to elevate.
      Returns:
      A DataFixer handling the map transform.
    • nestKeys

      static DataFixer nestKeys(String newMapKey, String... keysToNest)
      Flattens and shifts explicitly defined sibling keys into a shared child nested map.
      Parameters:
      newMapKey - The new identifier for the overarching map wrapper.
      keysToNest - Variadic target array of explicit keys to condense.
      Returns:
      A DataFixer executing the shift map transform.
    • addDefault

      static DataFixer addDefault(String key, Object value)
      Injects a predefined default primitive value if a key node does not physically exist.
      Parameters:
      key - The key target for enforcement.
      value - The primitive payload fallback.
      Returns:
      A DataFixer ensuring structure conformity.
    • reorderKeys

      static DataFixer reorderKeys(String... patterns)
      Reorders keys within a map structure based on advanced pattern matching algorithms.

      Supported Pattern Syntax:

      • Exact Match: "key_name"
      • Prefix Match: "prefix_*"
      • Suffix Match: "*_suffix"
      • Contains Match: "*contains*"
      • Regex Match: "~^regex.*$" (Prefixed with tilde)
      • Remainder/Dump: "*" (Captures any keys not matched by explicit rules)
      Parameters:
      patterns - Sequential string rules prioritizing and organizing keys.
      Returns:
      A DataFixer executing structural sorting logic on the current node.
    • conditional

      static DataFixer conditional(DataFixer.DataPredicate predicate, DataFixer thenFixer, DataFixer elseFixer)
      Redirects internal data handling dependent on an explicitly provided logical predicate.
      Parameters:
      predicate - The verification condition encapsulating the current environment dynamic ops.
      thenFixer - Evaluated pipeline branch when the predicate returns physically true.
      elseFixer - Evaluated pipeline branch when the predicate returns physically false.
      Returns:
      A DataFixer executing contextual branch resolution.
    • updateElements

      static DataFixer updateElements(DataFixer elementFixer)
      Triggers cyclic recursive transformation operations universally executing across all array node elements.
      Parameters:
      elementFixer - Target internal sub-fixer iteration logic block.
      Returns:
      A DataFixer sequentially passing node list data to the provided execution target.