📄 dbaccessfactory.java
字号:
/**
* @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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -