private void registerClassDefinition( ClassDefinition cd, Map<Integer, ClassDefinition> classDefMap, boolean checkClassDefErrors) { for (int i = 0; i < cd.getFieldCount(); i++) { FieldDefinition fd = cd.get(i); if (fd.getType() == FieldType.PORTABLE || fd.getType() == FieldType.PORTABLE_ARRAY) { int classId = fd.getClassId(); ClassDefinition nestedCd = classDefMap.get(classId); if (nestedCd != null) { ((ClassDefinitionImpl) cd).addClassDef(nestedCd); registerClassDefinition(nestedCd, classDefMap, checkClassDefErrors); serializationContext.registerClassDefinition(nestedCd); } else if (checkClassDefErrors) { throw new HazelcastSerializationException( "Could not find registered ClassDefinition for class-id: " + classId); } } } serializationContext.registerClassDefinition(cd); }