예제 #1
0
  public static ProtoSampleNodes.SampleNode fromSampleNodeToProto(final SampleNode node) {

    ProtoSampleNodes.SampleNode.Builder resultBuilder =
        ProtoSampleNodes.SampleNode.newBuilder().setCount(node.getSampleCount());

    Map<Method, SampleNode> subNodes = node.getSubNodes();
    if (subNodes != null) {
      for (Map.Entry<Method, SampleNode> entry : subNodes.entrySet()) {
        resultBuilder.addSubNodes(
            ProtoSampleNodes.SamplePair.newBuilder()
                .setMethod(fromMethodToProto(entry.getKey()))
                .setNode(fromSampleNodeToProto(entry.getValue()))
                .build());
      }
    }
    return resultBuilder.build();
  }