Title: Generic VO methods

Your copy method needs to return the copy, not assign to the target property.

 


From: [email protected] [mailto:[email protected]] On Behalf Of Ault, Gary - BLS
Sent: Tuesday, February 21, 2006 12:40 PM
To: [email protected]
Subject: [flexcoders] Generic VO methods

 

I would like to create generic clear and copy methods for a value object class. Will the following code work? I thought I read somewhere there is a problem with ObjectCopy. Thanks.

 

Gary Ault
Bureau of Labor Statistics

 

class vo.UserVO {
    import mx.utils.ObjectCopy;

    var userId:Number;
    var firstName:String;
    var lastName:String;
    var lanID:String;
    var emailAddr:String;
    var roles:Array;
    var groups:Array;
    var _remoteClass:String;

    function UserVO() {
        _remoteClass = "xxx.vos.UserVO";
        clearUser();
    }

    function clear() {
        for (var p in this) {
                if (typeof this[p] == "String") {
                        this[p] = '';
                }
                else {
                        this[p] = undefined;   
                }
        }
   }

    function copy(target: UserVO): Void {
               
        target = UserVO(ObjectCopy.copy(this));
    }
        ...




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to