Class FormPath

java.lang.Object
com.axelor.meta.headless.FormPath

public final class FormPath extends Object
A node of a form's record tree: the root, a line of one of its collections, a line of a line, to any depth.
Paths
(empty)the root
items[#42]the line of items with id 42
items[-1]the first new line of the session: new lines get negative ids, in the order they arrive, as the client's cid — whether a step adds them or an action brings them, as a form's onNew its default lines
items[0]the first line of items as it stands when the step runs
items[-1].subTasks[#7]a line of a line

An id and a cid name the same line for the whole session, whatever actions do to the order of lines, and a cid keeps naming its line after a save gives it an id. A position is for authors who know no id.

A field of a node is written after its path: items[-1].product; split(java.lang.String) separates the two.

  • Method Details

    • root

      public static FormPath root()
      The root record.
    • line

      public static FormPath line(String collection, long n)
      A line of a collection of the root: by cid when n is negative, else by position.
      See Also:
    • child

      public FormPath child(String collection, long n)
      A line of a collection of this node: by cid when n is negative, else by position.
    • id

      public FormPath id(String collection, long id)
      The line of a collection of this node with this id.
    • parse

      public static FormPath parse(String text)
      Parses a path: segments name[#id], name[-cid] or name[position], joined by dots; blank or null is the root.
      Throws:
      IllegalArgumentException - when the text is not a path
    • split

      public static FormPath.Split split(String text)
      Separates a node's path from the name written after it: items[-1].product is the line items[-1] and its field product; customer.name is the root and customer.name; items[0] is the line and an empty name.
      Throws:
      IllegalArgumentException - when a segment is malformed
    • segments

      public List<FormPath.Segment> segments()
    • isRoot

      public boolean isRoot()
    • parent

      public FormPath parent()
      The node above this line; the root's parent is null.
    • last

      public FormPath.Segment last()
      The last segment: how this line is named in its collection; null for the root.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object