KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > cfg > DefaultNamingStrategy


1 //$Id: DefaultNamingStrategy.java,v 1.1 2004/06/03 16:30:05 steveebersole Exp $
2
package org.hibernate.cfg;
3
4 import java.io.Serializable JavaDoc;
5
6 import org.hibernate.util.StringHelper;
7
8 /**
9  * The default <tt>NamingStrategy</tt>
10  * @see ImprovedNamingStrategy a better alternative
11  * @author Gavin King
12  */

13 public class DefaultNamingStrategy implements NamingStrategy, Serializable JavaDoc {
14
15     /**
16      * The singleton instance
17      */

18     public static final NamingStrategy INSTANCE = new DefaultNamingStrategy();
19
20     protected DefaultNamingStrategy() {}
21
22     /**
23      * Return the unqualified class name
24      */

25     public String JavaDoc classToTableName(String JavaDoc className) {
26         return StringHelper.unqualify(className);
27     }
28     /**
29      * Return the unqualified property name
30      */

31     public String JavaDoc propertyToColumnName(String JavaDoc propertyName) {
32         return StringHelper.unqualify(propertyName);
33     }
34     /**
35      * Return the argument
36      */

37     public String JavaDoc tableName(String JavaDoc tableName) {
38         return tableName;
39     }
40     /**
41      * Return the argument
42      */

43     public String JavaDoc columnName(String JavaDoc columnName) {
44         return columnName;
45     }
46     /**
47      * Return the unqualified property name
48      */

49     public String JavaDoc propertyToTableName(String JavaDoc className, String JavaDoc propertyName) {
50         return StringHelper.unqualify(propertyName);
51     }
52 }
Popular Tags