public class Utils { public static Object process(Object o) { if (o == null) return null; if (o instanceof String) return ((String) o).trim(); if (o instanceof Integer) return o; if (o instanceof List) return process(((List) o).get(0)); return o.toString(); } }