Hi Michael, 

Huh? Your question is a bit weird. Delegator is an interface and the 
GenericDelegator is an implementation of the interface so you cannot do a 
Delegator delegator = new Delegator() for example. 

Now if your question is should I declare the above variable to be a Delegator 
or GenericDelegator then I believe this does not even need an OFBiz expert to 
answer you. You should always design by contract and write to your interfaces 
instead of your concrete classes. This is just basic OOP. 

Here are some references that might help: 
https://en.wikipedia.org/wiki/Design_by_contract 
http://www.javapractices.com/topic/TopicAction.do?Id=194 

Taher Alkhateeb 

----- Original Message -----

From: "masionas" <[email protected]> 
To: [email protected] 
Sent: Thursday, 11 June, 2015 2:51:37 PM 
Subject: Delegator vs. GenericDelegator 

Hi Guys, 

Once I have got a "null" error in a line of code which was trying to get 
"GenericDelegator". I have replaced it with Delegator and restarted app then 
an error is gone. So I am not sure if restart helped or GenericDelegator was 
the problem. I must say that it worked for ages with Generic in that line 
and I have it in a few classes as well which work without a problem, at 
least so far. I have made a search through whole ofbiz app and under 
framework, product, etc. found out that both of them are used but Delegator 
is used more widely and only a few classes use GenericDelegator. Should I 
consider to put a particular one depending on a specific case? How to 
determine which one to use? I would appreciate any ideas on this. 

Thank you. 



-- 
View this message in context: 
http://ofbiz.135035.n4.nabble.com/Delegator-vs-GenericDelegator-tp4669907.html 
Sent from the OFBiz - User mailing list archive at Nabble.com. 

Reply via email to