KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > dozer > util > mapping > util > ClassMapKeyFactory


1 /*
2  * Copyright 2005-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15 */

16 package net.sf.dozer.util.mapping.util;
17
18 import org.apache.commons.lang.StringUtils;
19
20 /**
21  * @author tierney.matt
22  * @author garsombke.franz
23  */

24 public class ClassMapKeyFactory {
25   
26   private ClassMapKeyFactory() {
27   }
28
29   public static String JavaDoc createKey(Class JavaDoc sourceClass, Class JavaDoc destClass, String JavaDoc mapId) {
30     StringBuffer JavaDoc result = new StringBuffer JavaDoc(150);
31     if (StringUtils.isNotEmpty(mapId)) {
32       result.append(sourceClass.getName());
33       result.append(destClass.getName());
34       result.append(mapId);
35     } else {
36       result.append(sourceClass.getName());
37       result.append(destClass.getName());
38     }
39     return result.toString();
40   }
41
42   public static String JavaDoc createKey(Class JavaDoc sourceClass, Class JavaDoc destClass) {
43     return createKey(sourceClass, destClass, null);
44   }
45   
46   
47 }
48
Popular Tags