Re: Doing something stupid
Re: Doing something stupid
- Subject: Re: Doing something stupid
- From: Alan Ward <email@hidden>
- Date: Tue, 12 Aug 2003 09:55:19 -0700
Assuming the Number is actually an Integer (you'll need to check your
model to see what value class is actually used but my guess is that it's
an Integer) then this should work...
public Number userOffset() {
return new
Integer(((Integer)storedValueForKey("userID")).intValue() + 30);
}
Alan
On Tuesday, August 12, 2003, at 09:36 AM, Reid Bundonis wrote:
Ok, I have a class file generated from EOModeler that contains the
usual suspects. One is public Number userID(). I want to create an
offset of the value by adding to the returned value. I've done this in
the past with Strings, such as
public String productThumbnail() {
return "/thumbs/" + (String)storedValueForKey("productCode") +
"Thumb.jpg";
This allows me to drop a dynamic value into a custom string and access
it in an array of results. I am trying to do the same with a number and
I am not getting very far. I am trying to add a number to the userID
number and I get "operator + cannot be applied to
java.lang.Number,int." Shouldn't this work?
public Number userOffset() {
return (Number)storedValueForKey("userID") + 30;
I also tried to
return (Integer) ((Number)storedValueForKey("userID") + 30);
This gives me the same results. Why can't I simply add a number to
another number? Any help to show me why I am so stupid would be great.
_______________________________________________
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.
_______________________________________________
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.