dbaccessfactory.java
来自「这是一个买卖系统,一个模拟的系统,根据下订单,看订单,买,等功能」· Java 代码 · 共 49 行
JAVA
49 行
/**
* @author Michael Alexander Smith
* @version 2.0
*/
package DBAccess;
/**
* Manages the starting up of the database.
* The database may be Access, mySQL etc.
*/
// Pattern: Abstract Factory
// Fix to be
public class DBAccessFactory
{
static String theOS = getOSName();
private static String getOSName()
{
String os = System.getProperties().getProperty( "os.name" );
System.out.println("OS = " + os );
return os;
}
/**
* Return an object to setup access to the database.
*/
public DBAccess getNewDBAccess()
{
if ( theOS.startsWith( "Windows" ) )
{
return new WindowsAccess(); // Access Windows
}
if ( theOS.startsWith( "Linux" ) )
{
return new LinuxAccess(); // MySQL linux
}
return new DBAccess(); // Unknown
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?