com.github.zthulj.zcopybook.factory.NodeFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zCopybook Show documentation
Show all versions of zCopybook Show documentation
Library helping to convert positionnal inputs (cobol) to json, using a copybook format
The newest version!
package com.github.zthulj.zcopybook.factory;
import com.github.zthulj.zcopybook.model.*;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.LinkedHashMap;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class NodeFactory {
public static RootNode createRootNode() {
return new RootNode<>(new LinkedHashMap());
}
public static ParentNode createParentNode(ParentNode parent, int lvlNumber) {
return new ParentNode<>(parent, new LinkedHashMap<>(), lvlNumber);
}
public static ValueNode createValueNode(ParentNode parent, Coordinates coords) {
return createValueNode(parent, coords, ValueNode.ValueType.STRING);
}
public static ValueNode createValueNode(ParentNode parent, Coordinates coords, ValueNode.ValueType type) {
return new ValueNode(parent, coords, type);
}
public static ParentArrayNode createParentNodeArray(ParentNode parent, int lvlNumber, int occursNumber) {
return new ParentArrayNode(parent, lvlNumber, occursNumber);
}
}