Class UniversalPath

  • All Implemented Interfaces:
    Serializable

    public class UniversalPath
    extends Object
    implements Serializable
    A raw path is a Path that is keeping the user input as-is and only parses it when used.

    Dynamic Config needs to keep all user inputs.

    The problems with Path are:

    1. Parsing: Paths.get() will parse some user input into some segments. The input and parsing is per-platform so it can lead to different outcomes in both parsing and toString()

    - On Win: Paths.get("a/b") and Paths.get("a\\b") give 2 segments

    - On Lin: Paths.get("a/b") give 2 segments and Paths.get("a\\b") gives 1 segment

    2. User input is lost: when parsed, we loose the path separator that was initially used. As a consequence, all serializations could lead to different results that is different than the user input since it depends on the system where we are calling toString().

    So this class aims at resolving all of that, by keeping the user input, that will be used for equality checks, serialization and deserialization, and also provide the equivalent of the Path API when used.

    The parsing of the user input will be only done when the object will be queried and converted to a Path

    Author:
    Mathieu Carbou
    See Also:
    Serialized Form