1 package org.apache.torque.engine.database.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.List;
23
24 import org.apache.torque.engine.EngineException;
25
26 /***
27 * The generic interface to a name generation algorithm.
28 *
29 * @author <a href="mailto:dlr@finemaltcoding.com>Daniel Rall</a>
30 * @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
31 * @version $Id: NameGenerator.java 473814 2006-11-11 22:30:30Z tv $
32 */
33 public interface NameGenerator
34 {
35 /***
36 * The character used by most implementations as the separator
37 * between name elements.
38 */
39 char STD_SEPARATOR_CHAR = '_';
40
41 /***
42 * The character which separates the schema name from the table name
43 */
44 char SCHEMA_SEPARATOR_CHAR = '.';
45
46 /***
47 * Traditional method for converting schema table and column names
48 * to java names. The <code>CONV_METHOD_XXX</code> constants
49 * define how names for columns and tables in the database schema
50 * will be converted to java source names.
51 *
52 * @see JavaNameGenerator#underscoreMethod(String)
53 */
54 String CONV_METHOD_UNDERSCORE = "underscore";
55
56 /***
57 * Similar to {@link #CONV_METHOD_UNDERSCORE} except a possible
58 * schema name (preceding a dot (.) )is omitted
59 *
60 * @see JavaNameGenerator#underscoreOmitSchemaMethod(String)
61 */
62 String CONV_METHOD_UNDERSCORE_OMIT_SCHEMA = "underscoreOmitSchema";
63
64 /***
65 * Similar to {@link #CONV_METHOD_UNDERSCORE} except nothing is
66 * converted to lowercase.
67 *
68 * @see JavaNameGenerator#javanameMethod(String)
69 */
70 String CONV_METHOD_JAVANAME = "javaname";
71
72 /***
73 * Specifies no modification when converting from a schema column
74 * or table name to a java name.
75 */
76 String CONV_METHOD_NOCHANGE = "nochange";
77
78 /***
79 * Given a list of <code>String</code> objects, implements an
80 * algorithm which produces a name.
81 *
82 * @param inputs Inputs used to generate a name.
83 * @return The generated name.
84 * @throws EngineException if the name could not be generated
85 */
86 String generateName(List inputs) throws EngineException;
87 }