Re: EOModelPrototype CastClass Exception
Re: EOModelPrototype CastClass Exception
- Subject: Re: EOModelPrototype CastClass Exception
- From: Kieran Kelleher <email@hidden>
- Date: Sat, 18 Dec 2004 12:49:17 -0500
Hi James,
Sometimes breaking up a complex statement into simpler ones can help
figure out what's going wrong. Try something like this:
public Boolean canAdminSite() {
Integer aValue = (Integer)storedValueForKey("canAdminSite");
// If nulls allowed, check and return FALSE
if (aValue == null) {
return Boolean.FALSE;
}
// Not null, so TRUE if integer value of 1, FALSE otherwise
return ( aValue.intValue() == 1 ? Boolean.TRUE : Boolean.FALSE );
}
Regards, Kieran
On Dec 18, 2004, at 11:44 AM, James Cicenia wrote:
Hello -
I have an eogenerator template that creates code for Booleans:
public Boolean canAdminSite() {
return new
Boolean(((Integer)storedValueForKey("canAdminSite")).intValue()==1);
}
And my eomodel states:
ValueClass = Number
ExternalType = INT
ValueType = i
ValueClass = NSNumber
Why would the above code cause a class cast exception?
-James
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
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