Class DotNetPathParser

java.lang.Object
io.jenkins.plugins.configsplice.engine.xml.DotNetPathParser

public final class DotNetPathParser extends Object
Parser for the .NET shorthand grammar of SRS sections 8.2 and 8.3.
 app-settings-path       := 'appSettings.' shorthand-key [ '.@value' ]
 connection-strings-path := 'connectionStrings.' shorthand-name [ '.@connectionString' | '.@providerName' ]
 shorthand-key           := quoted | raw-literal
 

The remainder after the prefix is deliberately not split on dots. A .NET application setting is routinely named Logging.LogLevel.Default or BankApi:Key, and treating those as navigation would make the most common real key shapes unaddressable.

Ambiguity between a literal key that ends in .@value and an explicit terminal selector is resolved greedily — at most one trailing selector is recognised — with quoting as the escape hatch. See the worked cases in parse(String).

  • Method Details

    • isShorthand

      public static boolean isShorthand(String path)
      Reports whether path is claimed by one of the shorthands (SRS section 6.1 rule 2).

      This is the single definition of the shorthand/generic boundary: callers route on it and parse(String) claims a path on the same test, so the two cannot disagree about who owns a path. The decision is lexical — it reads only the path, never the document — so no file content can change how a path is interpreted.

    • parse

      public static DotNetPath parse(String input) throws SpliceException
      Parses an XML shorthand path.

      Worked cases from SRS section 8.2:

      • appSettings.ApiUrl -> key ApiUrl, attribute value
      • appSettings.Logging.LogLevel.Default -> key Logging.LogLevel.Default
      • appSettings.@value -> key @value (no dot separator, so no selector)
      • appSettings.Foo.@value.@value -> key Foo.@value, attribute value
      • appSettings.'Literal.Key.Ending.@value' -> that whole quoted string as the key
      Throws:
      SpliceException - ErrorCode.XML_PATH_UNSUPPORTED if the path is not one of the two supported shorthands, ErrorCode.PATH_SYNTAX if it is malformed