5 // Created by Michael Mayo on 2/9/11.
6 // Copyright 2011 __MyCompanyName__. All rights reserved.
9 #import "LoadBalancerUsage.h"
10 #import "NSObject+NSCoding.h"
13 @implementation LoadBalancerUsage
15 @synthesize identifier, averageNumConnections, incomingTransfer, outgoingTransfer, numVips, numPolls, startTime, endTime;
17 #pragma mark - Serialization
19 - (void)encodeWithCoder: (NSCoder *)coder {
20 [self autoEncodeWithCoder:coder];
23 - (id)initWithCoder:(NSCoder *)coder {
24 if ((self = [super init])) {
25 [self autoDecode:coder];
33 + (LoadBalancerUsage *)fromJSON:(NSDictionary *)dict {
34 LoadBalancerUsage *u = [[[LoadBalancerUsage alloc] init] autorelease];
35 u.identifier = [dict objectForKey:@"id"];
36 u.averageNumConnections = [[dict objectForKey:@"averageNumConnections"] doubleValue];
37 u.incomingTransfer = [[dict objectForKey:@"incomingTransfer"] longLongValue];
38 u.outgoingTransfer = [[dict objectForKey:@"outgoingTransfer"] longLongValue];
39 u.numVips = [[dict objectForKey:@"numVips"] intValue];
40 u.numPolls = [[dict objectForKey:@"numPolls"] intValue];
44 #pragma mark - Memory Management