Hi Michael, 

It does not matter "how" you instantiate the object. The only difference in the 
example you provided is that you cast whatever you retrieve from a map instead 
of creating it with the "new" operator. 

Either way, the best practice remains as I mentioned in the earlier email so 
please do visit the links. You do not go "more specific" unless you absolutely 
need to as a general rule in any system for any reason, and not specifically 
for OFBiz. 

Taher Alkhateeb 

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

From: "masionas" <[email protected]> 
To: [email protected] 
Sent: Thursday, 11 June, 2015 5:12:53 PM 
Subject: Re: Delegator vs. GenericDelegator 

Taher, I believe you are an expert and this is good that you know that 
interface can't be instantiated unless it is implemented in some particular 
class. My question was different though. 

In ofbiz you can see both of these: 

1) 
Delegator delegator = (Delegator) request.getAttribute("delegator"); 
delegator.findByAnd(...) 

2) 
GenericDelegator delegator = (GenericDelegator) 
request.getAttribute("delegator"); 
delegator.findOne(....) 

I think in earlier versions it used to be mostly GenericDelegator which was 
used, but in later ones it has been changed to Delegator. But there are 
still some places with Generic. I was wondering if there is something like 
ofbiz best practice for using either one. 




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

Reply via email to