⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbaccessfactory.java

📁 这是一个买卖系统,一个模拟的系统,根据下订单,看订单,买,等功能
💻 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 + -