Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Design Pattern & UML  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 动态域问题
haibo



CJSDN高级会员


发贴: 322
积分: 71
于 2005-03-25 09:41 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
如果运行时刻需要动态改变已有的对象结构,比如为对象增加属性和方法,或
动态构造对象,然后对新构造的对象实现持久化,而且这样的对象的类最好作为
以后系统里的一般类一样,可以随便使用,怎么解决呢?
1.用dynamaic Bean, 但是这样的构造的对象没有业务方法,要是作持久化
的话,用hibernate configuration API来构造配置,然后就可以直接用hibernateAPI来作持久化操作, 但是我不太清楚这样的dynamic class ,hibernate 是否认
作象普通的pojo一样?
2.把类的构造和编译环境集成进来,在实施时构造类和对象
大家有没有更好的办法?




作者 Re:动态域问题 [Re:haibo]
jigsaw

KK

CJSDN高级会员


发贴: 3666
积分: 93
于 2005-03-26 21:16 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这个需求不够明确:
1。增加方法是什么意思?单纯的setter/getter?
2。以后可以随便使用是什么意思?系统deploy了之后,谁来使用这些类?
增加新的代码?
3。持久化--表的结构在运行时需要修改?
4。业务方法?看来这些动态的类还需要增加新的业务方法?这个需求很BT啊!
5。最重要的,这个需求的背景是什么?是什么促使你提出这个要求的?



No one knows except both of us.
909090909090909090909090909090909090909090b8533ce76c8d6c241868968a0408c338b4ffbf
ISO/IEC 9899:1999
作者 Re:动态域问题 [Re:haibo]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2005-03-27 07:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
We have field injection. I am thinking about behavior injection(e.g.,spring AOP). Now he is way ahead of us, thinking about class(object template) injection. Buddy, I think it won't be here at least for a year.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:动态域问题 [Re:haibo]
haibo



CJSDN高级会员


发贴: 322
积分: 71
于 2005-03-28 09:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
说明了就是 ERP产品 要动态实现业务模型自建,我提供一个平台,deployer可以
客户现场简单实施就可以构建客户特定需要的业务系统及流程,因此需要动态
创建类,这样的类当然不是只有setter/getter方法的,还要有业务方法,业务流程
.数据库是要运行时刻修改的,以支持存储业务数据的需要.这样的需求不bt,只是
要求的灵活性很高,实现这样的平台,具体客户的业务就可以委派给deployer去作.Oracle ERP 原理和这就是差不多的.
AOP 我没接触过,不过 "属性注入","方法注入",这样的解决倒是新颖的
, 不知道能否解决我这样的需求.
参考了一下ofbiz, 准备研究一下 parser / Rule Engine,构建一个系统特定
的language.




作者 Re:动态域问题 [Re:haibo]
jigsaw

KK

CJSDN高级会员


发贴: 3666
积分: 93
于 2005-03-28 14:05 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
如果是动态的业务方法--那应该就是用rule了,而不是给一个类增加新的方法
不过我对规则引擎一窍不通。。。



No one knows except both of us.
909090909090909090909090909090909090909090b8533ce76c8d6c241868968a0408c338b4ffbf
ISO/IEC 9899:1999
作者 Re:动态域问题 [Re:haibo]
dissip

BigCat



发贴: 240
积分: 60
于 2005-04-13 17:27 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
why not to use meta-level abstraction instead of creating new classes

dissip edited on 2005-04-13 17:34

To live is to fight.


flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923