title: Use lombok @getter and @setter to simplify method
body: <p>This is my original class. </p>
  
  <pre><code>public class HierarchyTreeNode {
      private String label;
      private List&lt;HierarchyTreeNode&gt; children;
  
      public String getLabel() {
          return label;
      }
  
      public void setLabel(String label) {
          this.label = label;
      }
  
      public List&lt;HierarchyTreeNode&gt; getChildren() {
          return children;
      }
  
      public void addChild(HierarchyTreeNode child) {
          if (children == null) {
              children = new ArrayList&lt;&gt;();
          }
          children.add(child);
      }
  }
  </code></pre>
  
  <p>I wanted to use Lombok @getter and @setter here. "addChild" should be simplified as setter method and the initialization of children should be put in constructor. I have tried the following but am unable to understand how to make it work:</p>
  
  <pre><code>public class HierarchyTreeNode {
          @Getter
          private String label;
          private List&lt;HierarchyTreeNode&gt; children;
  
          public HierarchyTreeNode() {
            this.label = label;
            this.children = children;
          }
  
          public String getLabel() {
              return label;
          }
  
          public void setLabel(String label) {
              this.label = label;
          }
  
          public List&lt;HierarchyTreeNode&gt; getChildren() {
              return children;
          }
  
          @Setter
          public void addChild(HierarchyTreeNode child) {
              if (children == null) {
                  children = new ArrayList&lt;&gt;();
              }
              children.add(child);
          }
      }
  </code></pre>
  
  <p>My controller has the following function:</p>
  
  <pre><code>   if (!existingNodes.containsKey(childName)) {
              // find node or create new node
              HierarchyTreeNode node = existingNodes.get(parentName);
              if (node == null) {
                  // new top level node
                  node = new HierarchyTreeNode();
                  node.setLabel(parentName);
                  root.addChild(node);
                  existingNodes.put(parentName, node);
              }
              // add child
              HierarchyTreeNode child = new HierarchyTreeNode();
              child.setLabel(childName);
              node.addChild(child);
              existingNodes.put(childName, child);
          }
  </code></pre>
  
  <p>How can I use lombok to simplify addchild?</p>