Literal Values

Occasionally, the developer may need to represent a literal value using a path, as the widget API usually only supports paths to represent data. For this purpose, the developer may encode a literal value within a path, so that when the DataAccessor resolves the path, the literal value is returned. An example is shown below.

Figure 1. Encoding Literal Values
Path literalPath = ClientPaths.LITERAL_VALUE_PATH
    .extendPath(PathUtils.escape("a //literal// value"));

The literal value may contain characters that could be confused with the path syntax, so the value must be escaped when constructing the path. The PathUtils class in the curam.util.common.path package provides an escape method for this purpose. In the example, the method escapes the forward slash characters in the literal value and prevents them from being interpreted as separating path steps by the extendPath method. When the path is resolved using DataAccessor.get, the escaping will be reversed automatically, so there is no requirement on the consumer of the path to treat it differently to any other.