public JavaSerializer(Class cl, ClassLoader loader)
  {
    introspectWriteReplace(cl, loader);
    
    if (_writeReplace != null)
      _writeReplace.setAccessible(true);

    ArrayList primitiveFields = new ArrayList();
    ArrayList compoundFields = new ArrayList();
    
    for (; cl != null; cl = cl.getSuperclass()) {
      Field []fields = cl.getDeclaredFields();
      for (int i = 0; i < fields.length; i++) {
	Field field = fields[i];

	if (Modifier.isTransient(field.getModifiers())
	    || Modifier.isStatic(field.getModifiers()))
	  continue;

	// XXX: could parameterize the handler to only deal with public
	field.setAccessible(true);

	if (field.getType().isPrimitive()
	    || (field.getType().getName().startsWith("java.lang.")
		&& ! field.getType().equals(Object.class)))
	  primitiveFields.add(field);
	else
	  compoundFields.add(field);
      }
    }

    ArrayList fields = new ArrayList();
    fields.addAll(primitiveFields);
    fields.addAll(compoundFields);

    _fields = new Field[fields.size()];
    fields.toArray(_fields);

    _fieldSerializers = new FieldSerializer[_fields.length];

    for (int i = 0; i < _fields.length; i++) {
      _fieldSerializers[i] = getFieldSerializer(_fields[i].getType());
    }
  }