Now if only ColdFusion would support method overloading. ;)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Matt Woodward
Sent: Monday, April 11, 2005 1:05 PM
To: [email protected]
Subject: Re: CFC Bean Getter


I think the tricky part is accessing a specific array element on the
same line of code because of the notation that would be involved:
<cfreturn getSomeArray()[1] />

That doesn't really fly.  A getter can certainly return an array (a
getter can return ANY type of object and can even return arrays of
objects specifically by using myObject[] as your return type), but
typically you would set that to a variable and then access the element
you need.

If you have to do this frequently you might add another getter to your
bean that would allow you to get a specific element so you could
return the element directly (at which point you're not returning an
array but rather whatever type of data is in that element of the
array), but both because I haven't determined a way around it and also
in a lot of cases to make the code more clear, when a getter returns
an array and I need to get at specific elements I usually set the
array to a variable and then use array notation on the variable.

Let me know if that doesn't make sense or if I'm misunderstanding your
specific situation.

Matt

On Apr 11, 2005 12:57 PM, Daniel Elmore <[EMAIL PROTECTED]> wrote:
> Calling Matt Woodward...
>
> If a getter() returns an array, how do you access a position in that array
> in the same line of execution?
>
> <cfreturn getSomeArray()/> and I want to return the 1st cell only.
>
> Am I breaking bean rules? Can a getter not return an array?
>
> Thanks!
>
> ----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>    http://www.dfwcfug.org/form_MemberRegistration.cfm
>
>


--
Matt Woodward
[EMAIL PROTECTED]
http://www.mattwoodward.com
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
   http://www.dfwcfug.org/form_MemberRegistration.cfm





----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to