• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Opinions on static create…() methods for EOs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Opinions on static create…() methods for EOs


  • Subject: Opinions on static create…() methods for EOs
  • From: Paul Hoadley <email@hidden>
  • Date: Thu, 20 Feb 2014 15:06:01 +1030

Hello,

Say I have an entity Foo.  Often I will override the static createFoo() method declared in _Foo.java, perhaps several times with different signatures for different uses.  Say Foo has a to-one relationship to Bar, and I supply bar as an argument.  I'm a bit inconsistent as to whether I call:

	setBarRelationship(bar);

or:

	setBarRelationship(bar.localInstanceIn(ec));

in the body of the method, where ec is obviously the EOEditingContext supplied as an argument.  I would have thought that doing the latter was more convenient, because then the caller never has to worry about whether or not she needs to or remembers to localInstance the related object herself.  But I note that the built-in templates _don't_ do this, so that _Foo.createFoo() would just call setBarRelationship(bar) if bar was an argument.

Are there any gotchas here?  Is it safe to always call localInstanceIn() in these static create methods, or should it be left up to the caller?


--
Paul Hoadley
http://logicsquad.net/




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Opinions on static createŠ() methods for EOs
      • From: Chuck Hill <email@hidden>
    • Re: Opinions on static createŠ() methods for EOs
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Calling AjaxModalDialog programmatically
  • Next by Date: Re: Opinions on static createŠ() methods for EOs
  • Previous by thread: Re: Calling AjaxModalDialog programmatically
  • Next by thread: Re: Opinions on static createŠ() methods for EOs
  • Index(es):
    • Date
    • Thread