public static Object toRailoType(PageContext pc, Object value) throws PageException {
pc=ThreadLocalPageContext.get(pc);
if(pc!=null && value instanceof Pojo) {
try{
ComponentAccess c = ComponentUtil.toComponentAccess(pc.loadComponent(value.getClass().getName()));
ComponentWrap cw=ComponentWrap.toComponentWrap(Component.ACCESS_PRIVATE,c);
// delete this scope data members
Collection.Key[] keys = cw.keys();
Object member;
for(int i=0;i<keys.length;i++) {
member = cw.get(keys[i]);
if(member instanceof UDF) continue;
cw.removeEL(keys[i]);
}
Property[] props = c.getProperties(false);
Property prop;
for(int i=0;i<props.length;i++){
prop=props[i];
try{
cw.set(pc, KeyImpl.init(prop.getName()), toRailoType(pc,Reflector.callGetter(value, prop.getName())));
}
catch(PageException pe){
pe.printStackTrace();
}
}