Class StructNodeFactory
- java.lang.Object
-
- ru.vyarus.yaml.updater.parse.struct.model.StructNodeFactory
-
public final class StructNodeFactory extends java.lang.ObjectHelper factory class for creating correct node objects. It is not used by main code and exists only for tests and to simplify manual tree modifications in customUpdateListenerimplementations.In contrast to comments parser model, structural model (snakeyaml's) use exact parsed values and ignores all comments.
- Since:
- 18.08.2021
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StructNodecreateListObject(StructNode root, int padding, int lineNum, StructNode... props)Creates list item node for object.static StructNodecreateListValue(StructNode root, int padding, int lineNum, java.lang.String value)Creates scalar list value.static StructNodecreateProperty(StructNode root, int padding, int lineNum, java.lang.String key, java.lang.String value)Could be used to create any node type: with both key and value it would be property, without value - subtree root and without both key and value - stub for virtualized list item.
-
-
-
Method Detail
-
createProperty
public static StructNode createProperty(StructNode root, int padding, int lineNum, java.lang.String key, java.lang.String value)
Could be used to create any node type: with both key and value it would be property, without value - subtree root and without both key and value - stub for virtualized list item.- Parameters:
root- root node (may be null)padding- paddinglineNum- target line numberkey- property name (may be null)value- property value (may be null for subtree root)- Returns:
- created node
-
createListObject
public static StructNode createListObject(StructNode root, int padding, int lineNum, StructNode... props)
Creates list item node for object. Grouping node is required to preserve object structure.- Parameters:
root- root node (may be null)padding- paddinglineNum- target dash line numberprops- list item object properties (each could be subtree)- Returns:
- created node
-
createListValue
public static StructNode createListValue(StructNode root, int padding, int lineNum, java.lang.String value)
Creates scalar list value.- Parameters:
root- root node (may be null)padding- paddinglineNum- target dash line numbervalue- property value lines (may be null)- Returns:
- created node
-
-