Example #1
0
  public static SampleNode fromProtoToSampleNode(final ProtoSampleNodes.SampleNodeOrBuilder node) {

    TMap<Method, SampleNode> subNodes = null;

    List<ProtoSampleNodes.SamplePair> sns = node.getSubNodesList();
    if (sns != null) {
      subNodes = new THashMap<>();
      for (ProtoSampleNodes.SamplePair pair : sns) {
        final ProtoSampleNodes.Method method = pair.getMethod();
        subNodes.put(
            new Method(method.getDeclaringClass(), method.getMethodName()),
            fromProtoToSampleNode(pair.getNode()));
      }
    }
    return new SampleNode(node.getCount(), subNodes);
  }
Example #2
0
 public static ProtoSampleNodes.Method fromMethodToProto(final Method m) {
   return ProtoSampleNodes.Method.newBuilder()
       .setMethodName(m.getMethodName())
       .setDeclaringClass(m.getDeclaringClass())
       .build();
 }