Class HoconResolver

java.lang.Object
org.apache.juneau.marshall.hocon.HoconResolver

public class HoconResolver extends Object
Resolves ${var} and ${?var} substitutions in the parsed HOCON tree.

Resolution algorithm: single-pass depth-first over the tree. Substitutions reference paths in the root object (e.g., ${database.host}). Optional substitutions (${?var}) are silently removed if the path does not exist. Required substitutions (${var}) throw if the path is missing. Circular references are detected and cause an error.

See Also:
  • Constructor Details

  • Method Details

    • resolve

      public void resolve()
      Resolves all substitutions in-place in the tree.
      Throws:
      RuntimeException - If a required substitution path is missing or circular.
    • lookup

      public HoconValue lookup(String path)
      Looks up a dotted path in the root object.
      Parameters:
      path - The path (e.g., "database.host").
      Can be null (returns null).
      Returns:
      The value at that path, or null if the path is null, blank, or does not resolve to an existing value.
    • resolveConcatWithLookup

      Resolves a concatenation value with a custom lookup (for self-referential substitution). When the concat contains ${path}, the lookup is used instead of the root object. This allows path = ${path}"/bin" to append to the previous value.
      Parameters:
      concat - The concatenation to resolve.
      Must not be null.
      lookup - Custom lookup; for path X returns the value to use (e.g. previous value for self-ref).
      Must not be null.
      Returns:
      The resolved string value.