mpoeschl 2002/09/12 23:00:49
Modified: src/java/org/apache/torque/map ColumnMap.java
DatabaseMap.java TableMap.java
Log:
checkstyle fixes
Revision Changes Path
1.5 +11 -12
jakarta-turbine-torque/src/java/org/apache/torque/map/ColumnMap.java
Index: ColumnMap.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/ColumnMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ColumnMap.java 7 May 2002 16:51:00 -0000 1.4
+++ ColumnMap.java 13 Sep 2002 06:00:49 -0000 1.5
@@ -93,8 +93,7 @@
* @param name The name of the column.
* @param containingTable TableMap of the table this column is in.
*/
- public ColumnMap( String name,
- TableMap containingTable )
+ public ColumnMap(String name, TableMap containingTable)
{
this.columnName = name;
table = containingTable;
@@ -135,7 +134,7 @@
*
* @param type An Object specifying the type.
*/
- public void setType ( Object type )
+ public void setType (Object type)
{
this.type = type;
}
@@ -145,7 +144,7 @@
*
* @param size An int specifying the size.
*/
- public void setSize( int size )
+ public void setSize(int size)
{
this.size = size;
}
@@ -155,7 +154,7 @@
*
* @param pk True if column is a primary key.
*/
- public void setPrimaryKey( boolean pk )
+ public void setPrimaryKey(boolean pk)
{
this.pk = pk;
}
@@ -165,7 +164,7 @@
*
* @param nn True if column may be null.
*/
- public void setNotNull( boolean nn )
+ public void setNotNull(boolean nn)
{
this.notNull = nn;
}
@@ -176,9 +175,9 @@
* @param fullyQualifiedName The name of the table.column that is
* foreign.
*/
- public void setForeignKey(String fullyQualifiedName )
+ public void setForeignKey(String fullyQualifiedName)
{
- if ( fullyQualifiedName != null &&
+ if (fullyQualifiedName != null &&
fullyQualifiedName.length() > 0)
{
relatedTableName = fullyQualifiedName.substring(
@@ -201,8 +200,8 @@
*/
public void setForeignKey(String tableName, String columnName)
{
- if ( tableName != null && tableName.length() > 0 && columnName != null
- && columnName.length() > 0 )
+ if (tableName != null && tableName.length() > 0 && columnName != null
+ && columnName.length() > 0)
{
relatedTableName = tableName;
relatedColumnName = columnName;
@@ -261,7 +260,7 @@
*/
public boolean isForeignKey()
{
- if ( relatedTableName != null && relatedTableName.length() > 0)
+ if (relatedTableName != null && relatedTableName.length() > 0)
{
return true;
}
1.7 +19 -21
jakarta-turbine-torque/src/java/org/apache/torque/map/DatabaseMap.java
Index: DatabaseMap.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/DatabaseMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DatabaseMap.java 7 May 2002 16:51:00 -0000 1.6
+++ DatabaseMap.java 13 Sep 2002 06:00:49 -0000 1.7
@@ -126,9 +126,9 @@
* @param table The TableMap representation of the table.
* @return True if the database contains the table.
*/
- public boolean containsTable( TableMap table )
+ public boolean containsTable(TableMap table)
{
- return containsTable( table.getName() );
+ return containsTable(table.getName());
}
/**
@@ -137,11 +137,11 @@
* @param name The String representation of the table.
* @return True if the database contains the table.
*/
- public boolean containsTable( String name )
+ public boolean containsTable(String name)
{
- if ( name.indexOf('.') > 0 )
+ if (name.indexOf('.') > 0)
{
- name = name.substring( 0, name.indexOf('.') );
+ name = name.substring(0, name.indexOf('.'));
}
return tables.containsKey(name);
}
@@ -182,7 +182,7 @@
* @param name Name of the table.
* @return A TableMap, null if the table was not found.
*/
- public TableMap getTable( String name )
+ public TableMap getTable(String name)
{
return (TableMap) tables.get(name);
}
@@ -210,10 +210,10 @@
*
* @param tableName The name of the table.
*/
- public void addTable( String tableName )
+ public void addTable(String tableName)
{
- TableMap tmap = new TableMap( tableName, this );
- tables.put( tableName, tmap );
+ TableMap tmap = new TableMap(tableName, this);
+ tables.put(tableName, tmap);
}
/**
@@ -223,11 +223,10 @@
* @param tableName The name of the table.
* @param numberOfColumns The number of columns in the table.
*/
- public void addTable( String tableName,
- int numberOfColumns )
+ public void addTable(String tableName, int numberOfColumns)
{
- TableMap tmap = new TableMap( tableName, numberOfColumns, this );
- tables.put( tableName, tmap );
+ TableMap tmap = new TableMap(tableName, numberOfColumns, this);
+ tables.put(tableName, tmap);
}
/**
@@ -235,18 +234,17 @@
*
* @param map The TableMap representation.
*/
- public void addTable( TableMap map )
+ public void addTable(TableMap map)
{
- tables.put( map.getName(), map );
+ tables.put(map.getName(), map);
}
-
/**
* Set the ID table for this database.
*
* @param idTable The TableMap representation for the ID table.
*/
- public void setIdTable( TableMap idTable )
+ public void setIdTable(TableMap idTable)
{
this.idTable = idTable;
addTable(idTable);
@@ -259,10 +257,10 @@
*
* @param tableName The name for the ID table.
*/
- public void setIdTable( String tableName )
+ public void setIdTable(String tableName)
{
- TableMap tmap = new TableMap( tableName, this );
- setIdTable( tmap );
+ TableMap tmap = new TableMap(tableName, this);
+ setIdTable(tmap);
}
/**
1.10 +65 -75
jakarta-turbine-torque/src/java/org/apache/torque/map/TableMap.java
Index: TableMap.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/TableMap.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TableMap.java 14 Aug 2002 12:06:44 -0000 1.9
+++ TableMap.java 13 Sep 2002 06:00:49 -0000 1.10
@@ -117,11 +117,11 @@
*/
public TableMap(String tableName,
int numberOfColumns,
- DatabaseMap containingDB )
+ DatabaseMap containingDB)
{
this.tableName = tableName;
dbMap = containingDB;
- columns = new Hashtable( (int) (1.25 * numberOfColumns) + 1 );
+ columns = new Hashtable((int) (1.25 * numberOfColumns) + 1);
}
/**
@@ -130,12 +130,11 @@
* @param tableName The name of the table.
* @param containingDB A DatabaseMap that this table belongs to.
*/
- public TableMap(String tableName,
- DatabaseMap containingDB )
+ public TableMap(String tableName, DatabaseMap containingDB)
{
this.tableName = tableName;
dbMap = containingDB;
- columns = new Hashtable( 20 );
+ columns = new Hashtable(20);
}
/**
@@ -148,12 +147,12 @@
*/
public TableMap(String tableName,
String prefix,
- DatabaseMap containingDB )
+ DatabaseMap containingDB)
{
this.tableName = tableName;
this.prefix = prefix;
dbMap = containingDB;
- columns = new Hashtable( 20 );
+ columns = new Hashtable(20);
}
/**
@@ -162,9 +161,9 @@
* @param column A ColumnMap.
* @return True if the table contains the column.
*/
- public boolean containsColumn( ColumnMap column )
+ public boolean containsColumn(ColumnMap column)
{
- return containsColumn( column.getColumnName() );
+ return containsColumn(column.getColumnName());
}
/**
@@ -173,11 +172,11 @@
* @param name A String with the name of the column.
* @return True if the table contains the column.
*/
- public boolean containsColumn( String name )
+ public boolean containsColumn(String name)
{
- if ( name.indexOf('.') > 0 )
+ if (name.indexOf('.') > 0)
{
- name = name.substring( name.indexOf('.') + 1 );
+ name = name.substring(name.indexOf('.') + 1);
}
return columns.containsKey(name);
}
@@ -206,7 +205,7 @@
{
Object theType = ((ColumnMap) it.next()).getType();
if (!(theType instanceof String || theType instanceof Number
- || theType instanceof java.util.Date ) )
+ || theType instanceof java.util.Date))
{
return true;
}
@@ -277,6 +276,7 @@
/**
* Get the information used to generate a primary key using a sequence.
*
+ * @return information used to generate a primary key
* @deprecated Use getPrimaryKeyMethodInfo
*/
public Object getSequenceInfo()
@@ -307,11 +307,11 @@
* @param name A String with the name of the table.
* @return A ColumnMap.
*/
- public ColumnMap getColumn( String name )
+ public ColumnMap getColumn(String name)
{
try
{
- return (ColumnMap) columns.get( name );
+ return (ColumnMap) columns.get(name);
}
catch (Exception e)
{
@@ -325,9 +325,9 @@
*
* @param cmap A ColumnMap.
*/
- public void addColumn ( ColumnMap cmap )
+ public void addColumn (ColumnMap cmap)
{
- columns.put ( cmap.getColumnName(), cmap );
+ columns.put (cmap.getColumnName(), cmap);
}
/**
@@ -336,10 +336,9 @@
* @param columnName A String with the column name.
* @param type An Object specifying the type.
*/
- public void addColumn( String columnName,
- Object type )
+ public void addColumn(String columnName, Object type)
{
- addColumn( columnName, type, false, null, null, 0 );
+ addColumn(columnName, type, false, null, null, 0);
}
/**
@@ -349,11 +348,9 @@
* @param type An Object specifying the type.
* @param size An int specifying the size.
*/
- public void addColumn( String columnName,
- Object type,
- int size )
+ public void addColumn(String columnName, Object type, int size)
{
- addColumn( columnName, type, false, null, null, size );
+ addColumn(columnName, type, false, null, null, size);
}
/**
@@ -362,10 +359,9 @@
* @param columnName A String with the column name.
* @param type An Object specifying the type.
*/
- public void addPrimaryKey( String columnName,
- Object type )
+ public void addPrimaryKey(String columnName, Object type)
{
- addColumn( columnName, type, true, null, null, 0 );
+ addColumn(columnName, type, true, null, null, 0);
}
/**
@@ -375,11 +371,9 @@
* @param type An Object specifying the type.
* @param size An int specifying the size.
*/
- public void addPrimaryKey( String columnName,
- Object type,
- int size )
+ public void addPrimaryKey(String columnName, Object type, int size)
{
- addColumn( columnName, type, true, null, null, size );
+ addColumn(columnName, type, true, null, null, size);
}
/**
@@ -390,12 +384,12 @@
* @param fkTable A String with the foreign key table name.
* @param fkColumn A String with the foreign key column name.
*/
- public void addForeignKey( String columnName,
- Object type,
- String fkTable,
- String fkColumn )
+ public void addForeignKey(String columnName,
+ Object type,
+ String fkTable,
+ String fkColumn)
{
- addColumn( columnName, type, false, fkTable, fkColumn, 0 );
+ addColumn(columnName, type, false, fkTable, fkColumn, 0);
}
/**
@@ -407,13 +401,13 @@
* @param fkColumn A String with the foreign key column name.
* @param size An int specifying the size.
*/
- public void addForeignKey( String columnName,
- Object type,
- String fkTable,
- String fkColumn,
- int size )
+ public void addForeignKey(String columnName,
+ Object type,
+ String fkTable,
+ String fkColumn,
+ int size)
{
- addColumn( columnName, type, false, fkTable, fkColumn, size );
+ addColumn(columnName, type, false, fkTable, fkColumn, size);
}
/**
@@ -424,12 +418,12 @@
* @param fkTable A String with the foreign key table name.
* @param fkColumn A String with the foreign key column name.
*/
- public void addForeignPrimaryKey( String columnName,
- Object type,
- String fkTable,
- String fkColumn )
+ public void addForeignPrimaryKey(String columnName,
+ Object type,
+ String fkTable,
+ String fkColumn)
{
- addColumn( columnName, type, true, fkTable, fkColumn, 0 );
+ addColumn(columnName, type, true, fkTable, fkColumn, 0);
}
/**
@@ -441,13 +435,13 @@
* @param fkColumn A String with the foreign key column name.
* @param size An int specifying the size.
*/
- public void addForeignPrimaryKey( String columnName,
- Object type,
- String fkTable,
- String fkColumn,
- int size )
+ public void addForeignPrimaryKey(String columnName,
+ Object type,
+ String fkTable,
+ String fkColumn,
+ int size)
{
- addColumn( columnName, type, true, fkTable, fkColumn, size );
+ addColumn(columnName, type, true, fkTable, fkColumn, size);
}
/**
@@ -460,12 +454,12 @@
* @param fkColumn A String with the foreign key column name.
* @param size An int specifying the size.
*/
- private void addColumn( String name,
- Object type,
- boolean pk,
- String fkTable,
- String fkColumn,
- int size )
+ private void addColumn(String name,
+ Object type,
+ boolean pk,
+ String fkTable,
+ String fkColumn,
+ int size)
{
// If the tablename is prefixed with the name of the column,
// remove it ie: SCARAB_PROJECT.PROJECT_ID remove the
@@ -474,13 +468,10 @@
{
name = name.substring(getName().length() + 1);
}
- if ( fkTable != null &&
- fkTable.length() > 0 &&
- fkColumn != null &&
- fkColumn.length() > 0 )
+ if (fkTable != null && fkTable.length() > 0 && fkColumn != null
+ && fkColumn.length() > 0)
{
- if (fkColumn.indexOf('.') > 0 &&
- fkColumn.indexOf(fkTable) != -1)
+ if (fkColumn.indexOf('.') > 0 && fkColumn.indexOf(fkTable) != -1)
{
fkColumn = fkColumn.substring(fkTable.length() + 1);
}
@@ -490,7 +481,7 @@
col.setPrimaryKey(pk);
col.setForeignKey(fkTable, fkColumn);
col.setSize(size);
- columns.put( name, col );
+ columns.put(name, col);
}
/**
@@ -518,6 +509,7 @@
/**
* Sets the sequence information needed to generate a key
*
+ * @param pkInfo information needed to generate a key
* @deprecated Use setPrimaryKeyMethodInfo
*/
public void setSequenceInfo(Object pkInfo)
@@ -535,19 +527,17 @@
this.pkInfo = pkInfo;
}
-
//---Utility methods for doing intelligent lookup of table names
-
/**
* Tell me if i have PREFIX in my string.
*
* @param data A String.
* @return True if prefix is contained in data.
*/
- private final boolean hasPrefix ( String data )
+ private final boolean hasPrefix(String data)
{
- return ( data.indexOf(getPrefix()) != -1 );
+ return (data.indexOf(getPrefix()) != -1);
}
/**
@@ -556,7 +546,7 @@
* @param data A String.
* @return A String with data, but with prefix removed.
*/
- private final String removePrefix ( String data )
+ private final String removePrefix(String data)
{
return data.substring(getPrefix().length());
}
@@ -570,7 +560,7 @@
* @param data A String.
* @return A String with data processed.
*/
- public final String removeUnderScores (String data)
+ public final String removeUnderScores(String data)
{
String tmp = null;
StringBuffer out = new StringBuffer();
@@ -587,7 +577,7 @@
while (st.hasMoreTokens())
{
String element = (String) st.nextElement();
- out.append ( firstLetterCaps(element));
+ out.append (firstLetterCaps(element));
}
return out.toString();
}
@@ -598,7 +588,7 @@
* @param data A String.
* @return A String with data processed.
*/
- private final String firstLetterCaps ( String data )
+ private final String firstLetterCaps(String data)
{
String firstLetter = data.substring(0, 1).toUpperCase();
String restLetters = data.substring(1).toLowerCase();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>