• 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: Type casting in WOComponents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Type casting in WOComponents


  • Subject: Re: Type casting in WOComponents
  • From: Mike Schrag <email@hidden>
  • Date: Thu, 7 Jun 2007 10:36:27 -0400

"user.phone" is just like performing each of those method calls using Java reflection -- It's "type independent". Fundamentally this is an issue of your model design. If Administrator extends User (as an aside, this is generally not a good design style -- Administrator is a role of a user, not a subtype of a user ... meaning, you might eventually want to make a user NOT an administrator, but if it's typed as such, you're stuck) and user has the method "public String phone()" or "public String getPhone()", then Administrator does also. So binding value = user.phone where user is an Administrator OR a User will always work, because that method is inherited. What EXACTLY is the error you are getting? I suspect it's not the problem you think it is.

ms

On Jun 7, 2007, at 10:30 AM, Aaron Thompson wrote:

Forgive me if this is a really obvious answer, but what do you mean by "the key"? If phone is a property of Administrator but not User, and in my component I have a WOString with value = user.phone, it gives an error.

Otherwise, as Chuck kinda pointed out, it might be easiest to create separate edit pages and not fight it.

Thank you for your feedback,
Aaron Thompson

On Jun 6, 2007, at 6:49 PM, Guido Neitzer wrote:

On 06.06.2007, at 15:58, Aaron Thompson wrote:

I'd like to have a generic edit user page that can edit both of them. If this isn't possible, has anyone else found a solution to a similar situation?

You might just use the key ... it should work. No cast necessary. Or add a wrapper method in your subclass of the generic edit page to return the casted object.


cug

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


This email sent to email@hidden


_______________________________________________
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: Type casting in WOComponents
      • From: Mike Schrag <email@hidden>
References: 
 >Type casting in WOComponents (From: Aaron Thompson <email@hidden>)
 >Re: Type casting in WOComponents (From: Guido Neitzer <email@hidden>)
 >Re: Type casting in WOComponents (From: Aaron Thompson <email@hidden>)

  • Prev by Date: Re: Type casting in WOComponents
  • Next by Date: Re: Type casting in WOComponents
  • Previous by thread: Re: Type casting in WOComponents
  • Next by thread: Re: Type casting in WOComponents
  • Index(es):
    • Date
    • Thread