Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NameGenerator |
|
| 1.0;1 |
1 | package org.apache.torque.engine.database.model; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
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,v 1.1 2007-10-21 07:57:27 abyrne Exp $ | |
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 | } |