View Javadoc

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;
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.1.2.2 2004/05/20 04:34:15 seade 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       * Traditional method for converting schema table and column names
40       * to java names.  The <code>CONV_METHOD_XXX</code> constants
41       * define how names for columns and tables in the database schema
42       * will be converted to java source names.
43       *
44       * @see JavaNameGenerator#underscoreMethod(String)
45       */
46      String CONV_METHOD_UNDERSCORE = "underscore";
47  
48      /***
49       * Similar to {@link #CONV_METHOD_UNDERSCORE} except nothing is
50       * converted to lowercase.
51       *
52       * @see JavaNameGenerator#javanameMethod(String)
53       */
54      String CONV_METHOD_JAVANAME = "javaname";
55  
56      /***
57       * Specifies no modification when converting from a schema column
58       * or table name to a java name.
59       */
60      String CONV_METHOD_NOCHANGE = "nochange";
61  
62      /***
63       * Given a list of <code>String</code> objects, implements an
64       * algorithm which produces a name.
65       *
66       * @param inputs Inputs used to generate a name.
67       * @return The generated name.
68       * @throws EngineException if the name could not be generated
69       */
70      String generateName(List inputs) throws EngineException;
71  }