voFactory

Create a new VO:

var TestVO = AMF.voFactory([
	['name', {type: 'string'}],
	['age', {type: 'int'}],
	['height', {type: 'float'}],
	['friends', {type: 'array', defaultValue: null, addName: 'friend'}],
	'x',
	['y', {}]
]);
	

Create a new instance on t:

var t = new TestVO();

Set values:

t.setName('My Name');
t.setAge(28);
t.setHeight(1.74);
t.setFriends(['Friend A', 'Friend B']);
t.addFriend('Friend C');
t.setX('value X');
t.setY('value Y');
	

Get values:


Using parse method (JSON notation):

var v = {'name': 'My New Name', 'age': 29, 'height': 1,76, 'friends': ['Friend D', 'Friend E'], 'x': 'value X2', 'y': 'value Y2'};
t.parse(v);
	

Get new values:


parse(), toString() and serialize() are created as default, but you can reewrite anyone as you need.

TestVO.prototype.parse = function() { ... };
TestVO.prototype.toString = function() { ... };
TestVO.prototype.serialize = function() { ... };