org.apache.torque.engine.database.model
Class JavaNameGenerator

java.lang.Object
  extended by org.apache.torque.engine.database.model.JavaNameGenerator
All Implemented Interfaces:
NameGenerator

public class JavaNameGenerator
extends Object
implements NameGenerator

A NameGenerator implementation for Java-esque names.

Version:
$Id: JavaNameGenerator.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
Author:
Byron Foster

Field Summary
 
Fields inherited from interface org.apache.torque.engine.database.model.NameGenerator
CONV_METHOD_JAVANAME, CONV_METHOD_NOCHANGE, CONV_METHOD_UNDERSCORE, CONV_METHOD_UNDERSCORE_OMIT_SCHEMA, SCHEMA_SEPARATOR_CHAR, STD_SEPARATOR_CHAR
 
Constructor Summary
JavaNameGenerator()
           
 
Method Summary
 String generateName(List inputs)
          inputs should consist of two elements, the original name of the database element and the method for generating the name.
protected  String javanameMethod(String schemaName)
          Converts a database schema name to java object name.
protected  String nochangeMethod(String name)
          Converts a database schema name to java object name.
protected  String underscoreMethod(String schemaName)
          Converts a database schema name to java object name.
protected  String underscoreOmitSchemaMethod(String schemaName)
          Converts a database schema name to java object name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaNameGenerator

public JavaNameGenerator()
Method Detail

generateName

public String generateName(List inputs)
inputs should consist of two elements, the original name of the database element and the method for generating the name. There are currently three methods: CONV_METHOD_NOCHANGE - xml names are converted directly to java names without modification. CONV_METHOD_UNDERSCORE will capitalize the first letter, remove underscores, and capitalize each letter before an underscore. All other letters are lowercased. "javaname" works the same as the CONV_METHOD_JAVANAME method but will not lowercase any characters.

Specified by:
generateName in interface NameGenerator
Parameters:
inputs - list expected to contain two parameters, element 0 contains name to convert, element 1 contains method for conversion.
Returns:
The generated name.
See Also:
NameGenerator

underscoreMethod

protected String underscoreMethod(String schemaName)
Converts a database schema name to java object name. Removes STD_SEPARATOR_CHAR and SCHEMA_SEPARATOR_CHAR, capitilizes first letter of name and each letter after the STD_SEPERATOR and SCHEMA_SEPARATOR_CHAR, converts the rest of the letters to lowercase.

Parameters:
schemaName - name to be converted.
Returns:
converted name.
See Also:
NameGenerator, underscoreMethod(String)

underscoreOmitSchemaMethod

protected String underscoreOmitSchemaMethod(String schemaName)
Converts a database schema name to java object name. First, it removes all characters before the last occurence of .SCHEMA_SEPARATOR_CHAR. Then, in a second step, removes STD_SEPARATOR_CHAR, capitilizes first letter of name and each letter after the STD_SEPERATOR, and converts the rest of the letters to lowercase.

Parameters:
schemaName - name to be converted.
Returns:
converted name.
See Also:
NameGenerator, underscoreOmitSchemaMethod(String)

javanameMethod

protected String javanameMethod(String schemaName)
Converts a database schema name to java object name. Operates same as underscoreMethod but does not convert anything to lowercase.

Parameters:
schemaName - name to be converted.
Returns:
converted name.
See Also:
NameGenerator, underscoreMethod(String)

nochangeMethod

protected final String nochangeMethod(String name)
Converts a database schema name to java object name. In this case no conversion is made.

Parameters:
name - name to be converted.
Returns:
The name parameter, unchanged.


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.