抽象工厂模式实现

时间:2014-10-12 07:00:01

标签: java business-logic abstract-factory

嗨我跟随抽象的factorn模式,并试图弄清楚这是否是正确的方法,对于数据库连接工厂,

interface ConnectionInterface{//method declarations..}
abstract class ConnectionState implements interface{ //implementing all methods but one connect()}
final class SomedatabasSubclass extends ConnectionState{//only implied to override connect method}
//more subclasses extending the state

我之前发布了这个,但是讨论对于实现其他模式,https://stackoverflow.com/a/26256427/2323234我需要将businesslogic与实现类分开,模式是次要的,并且尽可能少地重写代码,这将用于不同的产品,因此它将被用作api,因此只需要某个特定实现的子类,因为将有数据库类型扩展jar中包含的api, 在某些产品中它的oracle / mysql / etc, 当我们与不同的客户dbs交谈时,其他产品将有不同类型的RDBM。所以我需要它基本上在不同的环境中工作, 我也想知道抽象的ConnectionState类是否应该将所有变量保存为Connections和结果,语句等 感谢您的帮助,

0 个答案:

没有答案