/**
  * {@inheritDoc}
  *
  * <p>Overrides the implementation from {@link ForwardingReadableBlipData} in order to return a
  * subtype of {@link WaveletData}, as required by the {@link BlipData} interface.
  */
 @Override
 public UnmodifiableWaveletData getWavelet() {
   if (wavelet == null) {
     wavelet = WAVELET_FACTORY.create(data.getWavelet());
   }
   return wavelet;
 }
  /**
   * Serializes a document to a document snapshot.
   *
   * @param document The document to serialize
   * @return A snapshot of the given document
   */
  public static DocumentSnapshot serializeDocument(ReadableBlipData document) {
    DocumentSnapshot.Builder builder = DocumentSnapshot.newBuilder();

    builder.setDocumentId(document.getId());
    builder.setDocumentOperation(
        CoreWaveletOperationSerializer.serialize(document.getContent().asOperation()));

    builder.setAuthor(document.getAuthor().getAddress());
    for (ParticipantId participant : document.getContributors()) {
      builder.addContributor(participant.getAddress());
    }
    builder.setLastModifiedVersion(document.getLastModifiedVersion());
    builder.setLastModifiedTime(document.getLastModifiedTime());

    return builder.build();
  }