On Jul 12, 2012, at 3:26 PM, Maik Musall wrote:

> 
> Am 12.07.2012 um 23:58 schrieb Louis Demers:
>> User newUser = (User)EOUtilities.createAndInsertInstance(ec, 
>> User.ENTITY_NAME) ;
> 
> Much too wordy for my taste, and needs a cast on top of it. Just add a second 
> constructor in your template which does ec.insertObject(this), so that you 
> can simply use
> 
>       User newUser = new User( ec );
> 
> Do not delete the parameter-less constructor though, because EOF needs that 
> internally when restoring objects from db. But refrain from using that 
> anywhere in your app.
> 
> Maik

I know the rule is not followed strictly in WO/Wonder, but as a general rule in 
java, do not let 'this' escape the constructor.

http://www.javapractices.com/topic/TopicAction.do?Id=252

Ramsey
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to