KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > torque > engine > database > model > NameGenerator


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

18
19 import java.util.List JavaDoc;
20
21 import org.apache.torque.engine.EngineException;
22
23 /**
24  * The generic interface to a name generation algorithm.
25  *
26  * @author <a HREF="mailto:dlr@finemaltcoding.com>Daniel Rall</a>
27  * @author <a HREF="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
28  * @version $Id: NameGenerator.java,v 1.3 2005/02/23 17:32:09 tfischer Exp $
29  */

30 public interface NameGenerator
31 {
32     /**
33      * The character used by most implementations as the separator
34      * between name elements.
35      */

36     char STD_SEPARATOR_CHAR = '_';
37
38     /**
39      * The character which separates the schema name from the table name
40      */

41     char SCHEMA_SEPARATOR_CHAR = '.';
42
43     /**
44      * Traditional method for converting schema table and column names
45      * to java names. The <code>CONV_METHOD_XXX</code> constants
46      * define how names for columns and tables in the database schema
47      * will be converted to java source names.
48      *
49      * @see JavaNameGenerator#underscoreMethod(String)
50      */

51     String JavaDoc CONV_METHOD_UNDERSCORE = "underscore";
52
53     /**
54      * Similar to {@link #CONV_METHOD_UNDERSCORE} except a possible
55      * schema name (preceding a dot (.) )is omitted
56      *
57      * @see JavaNameGenerator#underscoreOmitSchemaMethod(String)
58      */

59     String JavaDoc CONV_METHOD_UNDERSCORE_OMIT_SCHEMA = "underscoreOmitSchema";
60
61     /**
62      * Similar to {@link #CONV_METHOD_UNDERSCORE} except nothing is
63      * converted to lowercase.
64      *
65      * @see JavaNameGenerator#javanameMethod(String)
66      */

67     String JavaDoc CONV_METHOD_JAVANAME = "javaname";
68
69     /**
70      * Specifies no modification when converting from a schema column
71      * or table name to a java name.
72      */

73     String JavaDoc CONV_METHOD_NOCHANGE = "nochange";
74
75     /**
76      * Given a list of <code>String</code> objects, implements an
77      * algorithm which produces a name.
78      *
79      * @param inputs Inputs used to generate a name.
80      * @return The generated name.
81      * @throws EngineException if the name could not be generated
82      */

83     String JavaDoc generateName(List JavaDoc inputs) throws EngineException;
84 }
85
Popular Tags