Package de.gematik.rbellogger.builder
Class RbelBuilder
java.lang.Object
de.gematik.rbellogger.builder.RbelBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionRbelBuilder(RbelContentTreeNode treeRootNode) Builder that builds and modifies a RbelContentTreeNode from various sources -
Method Summary
Modifier and TypeMethodDescriptionaddEntryAt(String rbelPath, String newValue) Adds a new entry at a list or array at a specific pathstatic RbelBuilderInitializes aRbelBuilderwith an object from a given filestatic RbelBuilderInitializes aRbelBuilder; the first direct child gets its key from the objectName parameter and its content from an object from a given filestatic RbelBuilderfromScratch(RbelContentType type) Initializes an emptyRbelBuilderstatic RbelBuilderfromString(String content) reads a formatted String and creates a newRbelBuilderusing the content as its treeRootNodeSerializes the treeRootNode into a formatted StringsetValueAt(String rbelPath, String newValue) Sets the value at a specific path to a new RbelContentTreeNode; the path or its parent must exist
-
Constructor Details
-
RbelBuilder
Builder that builds and modifies a RbelContentTreeNode from various sources- Parameters:
treeRootNode- initial treeRootNode
-
-
Method Details
-
fromFile
Initializes aRbelBuilderwith an object from a given file- Parameters:
pathName- file path of imported object- Returns:
- this
-
fromFile
Initializes aRbelBuilder; 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 objectobjectName- key of direct child- Returns:
- this
-
fromScratch
Initializes an emptyRbelBuilder- Parameters:
type- Rbel content type of treeNode- Returns:
- this
-
fromString
reads a formatted String and creates a newRbelBuilderusing the content as its treeRootNode- Parameters:
content- formatted String- Returns:
- this
-
getTreeRootNode
-
setValueAt
Sets the value at a specific path to a new RbelContentTreeNode; the path or its parent must exist- Parameters:
rbelPath- path where RbelContentTreeNode is insertednewValue- 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
Adds a new entry at a list or array at a specific path- Parameters:
rbelPath- path of array/listnewValue- value to be added- Returns:
- this
-
serialize
Serializes the treeRootNode into a formatted String- Returns:
- the formatted String
-