2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.sal.binding.impl.utils
10 import javassist.ClassPool
11 import javassist.NotFoundException
12 import javassist.LoaderClassPath
14 class GeneratorUtils {
16 static val PREFIX = "_gen.";
18 public static def generatedName(Class<?> cls, String suffix) {
19 '''«PREFIX»«cls.package.name».«cls.simpleName»$«suffix»'''.toString()
22 public static def get(ClassPool pool, Class<?> cls) {
24 return pool.get(cls.name)
25 } catch (NotFoundException e) {
26 pool.appendClassPath(new LoaderClassPath(cls.classLoader));
27 return pool.get(cls.name)