All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jvnet.jaxbcommons.tree.util.NodeUtils Maven / Gradle / Ivy

There is a newer version: 1.0.4.7
Show newest version
package org.jvnet.jaxbcommons.tree.util;

import java.util.List;

import org.jvnet.jaxbcommons.tree.Node;
import org.jvnet.jaxbcommons.tree.NodeCreator;

public class NodeUtils {

  private NodeUtils() {
  }

  public static Node[] createNodes(String name, Class type, List list) {
    final Node[] nodes = new Node[list.size()];
    for (int index = 0; index < list.size(); index++) {
      final Object object = list.get(index);
      if (object instanceof NodeCreator) {
        final NodeCreator flatable = (NodeCreator) object;
        nodes[index] = flatable.createNode(name);
      }
      else {
        nodes[index] = new Node(name, type, object, new Node[0]);
      }
    }
    return nodes;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy