public final class Reflection {
public static Object rebuild(Object o, Class c) {
- System.out.println("rebuild " + o + " (a " + (o==null?null:o.getClass().getName()) + ") " + c);
+ //System.out.println("rebuild " + o + " (a " + (o==null?null:o.getClass().getName()) + ") " + c);
if (o==null || c.isAssignableFrom(o.getClass())) return o;
if ((c == Character.class || c == Character.TYPE) && o instanceof String && ((String)o).length()==1) return new Character(((String)o).charAt(0));
if (o instanceof Character && c == String.class) return o+"";
Object[] ret = (Object[])Array.newInstance(c.getComponentType(), a.length);
for(int i=0; i<ret.length; i++) {
Object o2 = rebuild(a[i], c.getComponentType());
- if (o2 != null) System.out.println("storing " + o2.getClass().getName() + " to " + c.getComponentType());
+ //if (o2 != null) System.out.println("storing " + o2.getClass().getName() + " to " + c.getComponentType());
ret[i] = o2;
}
return ret;