• 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
Re: Accessing single element from NSArray of objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing single element from NSArray of objects


  • Subject: Re: Accessing single element from NSArray of objects
  • From: Jonathan Rochkind <email@hidden>
  • Date: Tue, 13 Apr 2004 16:06:09 -0500

At 4:29 PM -0400 4/13/04, Randall Perry wrote:
It's because when I initially created the key I had it create accessor
methods. So, for instance, it named  getCustInfo instead of getcustInfo.

If you tell it to use a 'get' accessor method, that method will be called getCustInfo, yes. And in any event, the set method will be called setCustInfo. The variable itself will always (in my experience) be named 'custInfo' when you ask WOBuilder to generate source for it. getCustInfo(), but variable 'custInfo'. By default, WOBuilder creates an accesor 'custInfo()', but you can tell it to do getCustInfo() instead, yes. That all conforms to the conventions. It's a variable named 'CustInfo' that does not, and that I've never seen WOBuilder do, but even if WOBuilder does it, it's still wrong.



 > I'm not exactly sure what you want to do, but certainly you can
 > directly access an object property within an array of objects within
 > one or two lines of code.
 >
Can this be condensed into one line?
     CustView eo = (CustView) CustInfo.objectAtIndex(0);
     String cust =  eo.cust();

Well, sure, if you want to:

String cust = ((CustView) CustInfo.objectAtIndex(0)).cust();

Again, I'd reccomend becoming more familiar with Java if you plan to write code in it. Or, feel free to switch back to Perl or PHP instead of WO with Java, sure.

--Jonathan




-- Randall Perry sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Accessing single element from NSArray of objects (From: Randall Perry <email@hidden>)

  • Prev by Date: Re: Accessing single element from NSArray of objects
  • Next by Date: Re: What class generates the sql?
  • Previous by thread: Re: Accessing single element from NSArray of objects
  • Next by thread: Re: Accessing single element from NSArray of objects
  • Index(es):
    • Date
    • Thread