ArgumentChecker.isTrue(clazz.isAssignableFrom(object.getClass()), "Unable to assign " + object.getClass() + " to " + clazz);
UniqueId uniqueId = UniqueId.of(IDENTIFIER_SCHEME_DEFAULT, GUIDGenerator.generate().toString());
if (object instanceof MutableUniqueIdentifiable) {
MutableUniqueIdentifiable identifiable = (MutableUniqueIdentifiable) object;
identifiable.setUniqueId(uniqueId);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FudgeObjectWriter objectWriter = getFudgeContext().createObjectWriter(baos);
objectWriter.write(object);