Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use generics
  • Loading branch information
chenson42 committed Jun 25, 2010
1 parent a7c47ea commit ff33861
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Expand Up @@ -56,19 +56,19 @@
public class PlatformFactory
{
/** The database name -> platform map. */
private static Map _platforms = null;
private static Map<String,Class<Platform>> _platforms = null;

/**
* Returns the platform map.
*
* @return The platform list
*/
private static synchronized Map getPlatforms()
private static synchronized Map<String,Class<Platform>> getPlatforms()
{
if (_platforms == null)
{
// lazy initialization
_platforms = new HashMap();
_platforms = new HashMap<String,Class<Platform>>();
registerPlatforms();
}
return _platforms;
Expand All @@ -83,7 +83,7 @@ private static synchronized Map getPlatforms()
*/
public static synchronized Platform createNewPlatformInstance(String databaseName) throws DdlUtilsException
{
Class platformClass = (Class)getPlatforms().get(databaseName.toLowerCase());
Class<Platform> platformClass = getPlatforms().get(databaseName.toLowerCase());

try
{
Expand Down
Expand Up @@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import javax.sql.DataSource;

Expand Down Expand Up @@ -125,9 +126,9 @@ public class PlatformUtils
public static final String JDBC_SUBPROTOCOL_JTDS_SYBASE = "jtds:sybase";

/** Maps the sub-protocl part of a jdbc connection url to a OJB platform name. */
private HashMap jdbcSubProtocolToPlatform = new HashMap();
private HashMap<String,String> jdbcSubProtocolToPlatform = new HashMap<String,String>();
/** Maps the jdbc driver name to a OJB platform name. */
private HashMap jdbcDriverToPlatform = new HashMap();
private HashMap<String,String> jdbcDriverToPlatform = new HashMap<String,String>();

/**
* Creates a new instance.
Expand Down Expand Up @@ -292,9 +293,9 @@ public String determineDatabaseType(String driverName, String jdbcConnectionUrl)
{
return null;
}
for (Iterator it = jdbcSubProtocolToPlatform.entrySet().iterator(); it.hasNext();)
for (Iterator<Entry<String,String>> it = jdbcSubProtocolToPlatform.entrySet().iterator(); it.hasNext();)
{
Map.Entry entry = (Map.Entry)it.next();
Map.Entry<String,String> entry = (Map.Entry<String,String>)it.next();
String curSubProtocol = "jdbc:" + (String)entry.getKey() + ":";

if (jdbcConnectionUrl.startsWith(curSubProtocol))
Expand Down

0 comments on commit ff33861

Please sign in to comment.