@Override public void serialize(Object obj) throws IOException { long val = (obj == null) ? 0 : ((Number) obj).longValue(); writer.add(val); }