Resolve Bug:445 Remove freemarker from config code generator.
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / TypeHelper.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl;
9
10 class TypeHelper {
11
12     /**
13      * Output string representing java notation of generic class, e.g.
14      * "List<String>" for input parameters List.class, String.class
15      */
16     static String getGenericType(Class<?> type, Class<?>... parameters) {
17         StringBuffer sb = new StringBuffer();
18         sb.append(type.getCanonicalName());
19         if (parameters.length > 0) {
20             sb.append("<");
21             boolean first = true;
22             for (Class<?> parameter : parameters) {
23                 if (first) {
24                     first = false;
25                 } else {
26                     sb.append(",");
27                 }
28                 sb.append(parameter.getCanonicalName());
29             }
30             sb.append(">");
31         }
32         return sb.toString();
33     }
34 }