Class RbelBuilder

java.lang.Object
de.gematik.rbellogger.builder.RbelBuilder

public class RbelBuilder extends Object
  • Constructor Details

    • RbelBuilder

      public RbelBuilder(RbelContentTreeNode treeRootNode)
      Builder that builds and modifies a RbelContentTreeNode from various sources
      Parameters:
      treeRootNode - initial treeRootNode
  • Method Details

    • fromFile

      public static RbelBuilder fromFile(String pathName)
      Initializes a RbelBuilder with an object from a given file
      Parameters:
      pathName - file path of imported object
      Returns:
      this
    • fromFile

      public static RbelBuilder fromFile(String objectName, String pathName)
      Initializes a RbelBuilder; the first direct child gets its key from the objectName parameter and its content from an object from a given file
      Parameters:
      pathName - file path of imported object
      objectName - key of direct child
      Returns:
      this
    • fromScratch

      public static RbelBuilder fromScratch(RbelContentType type)
      Initializes an empty RbelBuilder
      Parameters:
      type - Rbel content type of treeNode
      Returns:
      this
    • fromString

      public static RbelBuilder fromString(String content)
      reads a formatted String and creates a new RbelBuilder using the content as its treeRootNode
      Parameters:
      content - formatted String
      Returns:
      this
    • getTreeRootNode

      public RbelContentTreeNode getTreeRootNode()
    • setValueAt

      public RbelBuilder setValueAt(String rbelPath, String newValue)
      Sets the value at a specific path to a new RbelContentTreeNode; the path or its parent must exist
      Parameters:
      rbelPath - path where RbelContentTreeNode is inserted
      newValue - primitive String; or object as formatted String
      Returns:
      this
      Throws:
      RbelPathException - if path is not a proper Rbel path or if path and its parent do not exist
    • addEntryAt

      public RbelBuilder addEntryAt(String rbelPath, String newValue)
      Adds a new entry at a list or array at a specific path
      Parameters:
      rbelPath - path of array/list
      newValue - value to be added
      Returns:
      this
    • serialize

      public String serialize()
      Serializes the treeRootNode into a formatted String
      Returns:
      the formatted String