hallikpapa
asked on
Implicit cast of int to boolean in VO
I am returning a UseraccountVO, and it contains an array of MappedusernameVO(s)
The property "allowed" in every Mappedusername comes into flex as either a 1 or 0. I want flex to convert it to true or false, as they are used for checkboxes.
The VO is setting everything to true. How can I setup the VO so it will convert 0's to false, and 1's to true?
The property "allowed" in every Mappedusername comes into flex as either a 1 or 0. I want flex to convert it to true or false, as they are used for checkboxes.
The VO is setting everything to true. How can I setup the VO so it will convert 0's to false, and 1's to true?
package com.model.vo
{
[RemoteClass(alias="com.model.vo.UseraccountVO")]
[Bindable]
public class UseraccountVO
{
[ArrayElementType("com.model.vo.MappedusernameVO")]
public var Mappedusernames :Array = new Array();
public var id:int = 0;
public var userName:String = '';
}
}
///
///
///
package com.model.vo
{
[RemoteClass(alias="com.model.vo.MappedusernameVO")]
[Bindable]
public class MappedusernameVO
{
public var userID :int = 0;
public var servicesID :int = 0;
public var userName :String = "";
public var allowed :Boolean = false;
}
}
ASKER
I am sorry. VO stands for Value Object. Immediately when the data is received, it is coerced into the objects I posted above. I tried setting up a constructor that goes
allowed = Boolean(allowed);
But that didn't seem to work unless I did it incorrectly.
allowed = Boolean(allowed);
But that didn't seem to work unless I did it incorrectly.
ASKER
I should add, they all come back built already, and the only coercion I do into the value objects is here:
userForm.user = UseraccountVO(note.getBody ());
So I believe even if there is a constructor in the Mappedusername, it isn't being called.
userForm.user = UseraccountVO(note.getBody
So I believe even if there is a constructor in the Mappedusername, it isn't being called.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
What the object is in the back end is what it will be in flex. Is it 1 or 0? send it as true/false from the server.
That's what I said in the previous comment, yes.
Yep pretty much. Presuming backend is java but that apply to any other languages aswell.
ASKER
Yeah that was my first answer, but the guy who did the backend said just handle it on the flex side. I told him I veto that on the grounds it's stupid, but he was like can you see if you can, so I thought I would at least ask. :)
Anyways, enough of that, thanks guys!
Anyways, enough of that, thanks guys!
Good luck.
Thanx 4 axxepting
Thanx 4 axxepting
BTW, what is VO???
CyanBlue
Open in new window