Coverage Report - org.apache.torque.engine.database.model.NameGenerator
 
Classes in this File Line Coverage Branch Coverage Complexity
NameGenerator
N/A
N/A
1
 
 1  
 package org.apache.torque.engine.database.model;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
 5  
  * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 7  
  * License. You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 12  
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 13  
  * specific language governing permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 import java.util.List;
 17  
 
 18  
 import org.apache.torque.engine.EngineException;
 19  
 
 20  
 /**
 21  
  * The generic interface to a name generation algorithm.
 22  
  * 
 23  
  * @author <a href="mailto:dlr@finemaltcoding.com>Daniel Rall</a>
 24  
  * @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
 25  
  * @version $Id: NameGenerator.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
 26  
  */
 27  
 public interface NameGenerator {
 28  
     /**
 29  
      * The character used by most implementations as the separator between name elements.
 30  
      */
 31  
     char STD_SEPARATOR_CHAR = '_';
 32  
 
 33  
     /**
 34  
      * The character which separates the schema name from the table name
 35  
      */
 36  
     char SCHEMA_SEPARATOR_CHAR = '.';
 37  
 
 38  
     /**
 39  
      * Traditional method for converting schema table and column names to java names. The <code>CONV_METHOD_XXX</code>
 40  
      * constants define how names for columns and tables in the database schema will be converted to java source names.
 41  
      * 
 42  
      * @see JavaNameGenerator#underscoreMethod(String)
 43  
      */
 44  
     String CONV_METHOD_UNDERSCORE = "underscore";
 45  
 
 46  
     /**
 47  
      * Similar to {@link #CONV_METHOD_UNDERSCORE} except a possible schema name (preceding a dot (.) )is omitted
 48  
      * 
 49  
      * @see JavaNameGenerator#underscoreOmitSchemaMethod(String)
 50  
      */
 51  
     String CONV_METHOD_UNDERSCORE_OMIT_SCHEMA = "underscoreOmitSchema";
 52  
 
 53  
     /**
 54  
      * Similar to {@link #CONV_METHOD_UNDERSCORE} except nothing is converted to lowercase.
 55  
      * 
 56  
      * @see JavaNameGenerator#javanameMethod(String)
 57  
      */
 58  
     String CONV_METHOD_JAVANAME = "javaname";
 59  
 
 60  
     /**
 61  
      * Specifies no modification when converting from a schema column or table name to a java name.
 62  
      */
 63  
     String CONV_METHOD_NOCHANGE = "nochange";
 64  
 
 65  
     /**
 66  
      * Given a list of <code>String</code> objects, implements an algorithm which produces a name.
 67  
      * 
 68  
      * @param inputs
 69  
      *            Inputs used to generate a name.
 70  
      * @return The generated name.
 71  
      * @throws EngineException
 72  
      *             if the name could not be generated
 73  
      */
 74  
     String generateName(List inputs) throws EngineException;
 75  
 }