Class test = NSClassFromString(@"TestBean");
id obj = [[test alloc]init];
// Class cls = object_getClass(obj);
// Class test = class_getSuperclass(test1);
// id obj =[[test alloc]init];
unsigned int numberofIvars = 0;
Ivar* ivars = class_copyIvarList(test, &numberofIvars);
for(const Ivar* p = ivars; p< ivars+numberofIvars;p++){
Ivar const ivar = *p ;
const char* keyType = ivar_getTypeEncoding(ivar);
NSString* keyTypeValue = [[NSString stringWithUTF8String:ivar_getTypeEncoding(ivar)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSString* key = [NSString stringWithUTF8String:ivar_getName(ivar)];
// NSLog(@"cTypeByte = %@", keyTypeValue);
// if([keyTypeValue isEqual:cTypeArray]){
NSNumber* val = [NSNumber numberWithLongLong:10000l];
// NSLog(@"add value ");
[obj setValue:@"123456" forKey:key];
// }
NSLog(@"name=%@ value=%@ type=%@ ", key,[obj valueForKey:key],keyTypeValue);
// NSString* str = @"testing";
// NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];
//
// int8_t cr[7];
// [data getBytes:cr];
// for(int i=0; i<7; i++){
// NSLog(@"%d",cr[i]);
// }
// [obj setValue:@"testtest" forKey:@"serverBeanPath"];
// NSLog(@"value=======%@", [obj valueForKey:@"serverBeanPath"]);
//
// int8_t len = [str lengthOfBytesUsingEncoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingUTF8)];
//
// int test = 15;
// NSData* data = [NSData dataWithBytes:&test length:sizeof(test)];
// int8_t temp[sizeof(test)];
// [data getBytes:temp length:sizeof(test)];
//
// int temp1;
// [data getBytes:&temp length:sizeof(temp1)];
//
// NSLog(@"%d", temp1);
// NSMutableArray* array = [[NSMutableArray alloc]initWithCapacity:10];
// [array addObject:[NSNumber numberWithInt:2]];
//
// Vector* vt = [[Vector alloc]init];
// [vt setArray:array];
//
// NSLog(@"%d", [vt size]);
//
}
// u_int count;
// objc_property_t* properties = class_copyPropertyList(test, &count);
// free(properties);
//
// for(int i=0; i< count; i++){
objc_property_t property = properties[i];
char * cr = property_getName(property);
fprintf(stdout, "%s \n",cr);
NSString* fieldName;
[fieldName string]
SEL sel = NSSelectorFromString(fieldName);
Method method = class_getInstanceMethod(test, sel);
//
fprintf(stdout,"%s \n",property_copyAttributeValue(property,));
//
//
fprintf(stdout, "%s \n",sel_getName(method_getName(method)));
//
// }
//
u_int methodCount;
Method* methods = class_copyMethodList(test, &methodCount);
for(int i=0; i<methodCount; i++){
Method method = methods[i];
char* dst;
method_getReturnType(method, dst, 8);
fprintf(stdout, "%s | type = %s \n",sel_getName( method_getName(method)),dst);
}
AmfMessage* msg = [[AmfMessage alloc]init];
Class myClass = [msg class];
NSObject* object =[[myClass alloc] init];
//
// // insert code here...
NSLog(@"Hello, World!");