1 /*
2 * Copyright (C) 2004 TiongHiang Lee
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Email: thlee@onemindsoft.org
19 */
20 package org.onemind.commons.relabean.serialize;
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25
26 /***
27 * Describes the binding of a class and a name
28 * @author TiongHiang Lee (thlee@onemindsoft.org)
29 * @version $Id: NameBinding.java,v 1.2 2004/08/26 16:29:00 thlee Exp $ $Name: $
30 */
31 public class NameBinding
32 {
33 /*** the name mapping **/
34 private Map _nameBindings = new HashMap();
35
36 /***
37 * {@inheritDoc}
38 */
39 public NameBinding()
40 {
41 }
42
43 /***
44 * Get the name of the class in the model
45 * @param c the class
46 * @return the name of the class in the model
47 */
48 public String getName(Class c)
49 {
50 return (String) _nameBindings.get(c);
51 }
52
53 /***
54 * Add a name mapping of the bean
55 * @param c the class
56 * @param name the name
57 */
58 public void bind(Class c, String name)
59 {
60 _nameBindings.put(c, name);
61 }
62
63 /***
64 * Get all the name mappings
65 * @return the name mappings
66 */
67 public Map getBindings()
68 {
69 return _nameBindings;
70 }
71 }