static void writeSlotWithDefaultMethod(
      ClassMetaDataSlot slot,
      ObjectOutput out,
      Object obj,
      ObjectSubstitutionInterface substitution)
      throws IOException {
    ObjectOutputStream oos = new ObjectOutputStreamProxy(out, obj, slot, substitution);
    ObjectOutputStream.PutField putField = oos.putFields();
    ClassMetadataField[] fields = slot.getFields();
    FieldsManager fieldsManager = FieldsManager.getFieldsManager();

    for (int fieldNR = 0; fieldNR < fields.length; fieldNR++) {
      ClassMetadataField classMetadataField = fields[fieldNR];
      Class type = classMetadataField.getField().getType();
      String fieldName = classMetadataField.getFieldName();

      if (type == Boolean.TYPE) {
        putField.put(fieldName, fieldsManager.getBoolean(obj, classMetadataField));
      } else if (type == Byte.TYPE) {
        putField.put(fieldName, fieldsManager.getByte(obj, classMetadataField));
      } else if (type == Character.TYPE) {
        putField.put(fieldName, fieldsManager.getCharacter(obj, classMetadataField));
      } else if (type == Short.TYPE) {
        putField.put(fieldName, fieldsManager.getShort(obj, classMetadataField));
      } else if (type == Integer.TYPE) {
        putField.put(fieldName, fieldsManager.getInt(obj, classMetadataField));
      } else if (type == Long.TYPE) {
        putField.put(fieldName, fieldsManager.getLong(obj, classMetadataField));
      } else if (type == Float.TYPE) {
        putField.put(fieldName, fieldsManager.getFloat(obj, classMetadataField));
      } else if (type == Double.TYPE) {
        putField.put(fieldName, fieldsManager.getDouble(obj, classMetadataField));
      } else {
        Object value = fieldsManager.getObject(obj, classMetadataField);
        putField.put(fieldName, value);
      }
    }

    oos.writeFields();
  }
  static void readSlotWithDefaultMethod(
      ClassMetaDataSlot slot, short[] fieldsKey, ObjectInput input, Object obj)
      throws IOException, ClassNotFoundException {
    FieldsContainer container = new FieldsContainer(slot);
    container.readMyself(input);
    ClassMetadataField[] fields = slot.getFields();
    ObjectInputStream.GetField getField = container.createGet();
    short numberOfFields = (short) fieldsKey.length;

    for (short i = 0; i < numberOfFields; i++) {
      ClassMetadataField classMetadata = slot.getFields()[fieldsKey[i]];
      Field field = classMetadata.getField();
      Class type = field.getType();
      String name = classMetadata.getFieldName();
      FieldsManager fieldsManager = FieldsManager.getFieldsManager();

      if (type == Boolean.TYPE) {
        fieldsManager.setBoolean(obj, classMetadata, getField.get(name, false));
      } else if (type == Byte.TYPE) {
        fieldsManager.setByte(obj, classMetadata, getField.get(name, (byte) 0));
      } else if (type == Character.TYPE) {
        fieldsManager.setCharacter(obj, classMetadata, getField.get(name, (char) 0));
      } else if (type == Short.TYPE) {
        fieldsManager.setShort(obj, classMetadata, getField.get(name, (short) 0));
      } else if (type == Integer.TYPE) {
        fieldsManager.setInt(obj, classMetadata, getField.get(name, (int) 0));
      } else if (type == Long.TYPE) {
        fieldsManager.setLong(obj, classMetadata, getField.get(name, (long) 0));
      } else if (type == Float.TYPE) {
        fieldsManager.setFloat(obj, classMetadata, getField.get(name, (float) 0));
      } else if (type == Double.TYPE) {
        fieldsManager.setDouble(obj, classMetadata, getField.get(name, (double) 0));
      } else {
        fieldsManager.setObject(obj, classMetadata, getField.get(name, null));
      }
    }
  }