protected ASObject toAMFObject(Component cfc) throws PageException {
// add properties
ASObject aso = doProperties?super.toAMFObject(cfc):new ASObject();
ComponentWrap cw=null;
if(cfc instanceof ComponentAccess)cw=ComponentWrap.toComponentWrap(Component.ACCESS_REMOTE,cfc);
Iterator it = cfc.entrySet().iterator();
Map.Entry entry;
Object v;
Collection.Key k;
UDF udf;
String name;
while(it.hasNext()) {
entry=(Entry) it.next();
k=KeyImpl.toKey(entry.getKey());
v=entry.getValue();
// add getters
if(v instanceof UDF){
if(!doGetters) continue;
udf=(UDF) v;
name=udf.getFunctionName();
if(!StringUtil.startsWithIgnoreCase(name, "get"))continue;
if(udf.getReturnType()==CFTypes.TYPE_VOID) continue;
if(udf.getFunctionArguments().length>0) continue;
try {
v=cfc.call(ThreadLocalPageContext.get(), name, ArrayUtil.OBJECT_EMPTY);
} catch (PageException e) {
continue;
}
name=name.substring(3);
aso.put(toString(name,forceCFCLower), toAMFObject(v));
}
// add remote data members
if(cw!=null && doRemoteValues){
v=cw.get(k,null);
if(v!=null)aso.put(toString(k,forceCFCLower), toAMFObject(v));
}
}
return aso;
}