<commit_before>package hmda.serialization.institution

import java.io.NotSerializableException

import akka.serialization.SerializerWithStringManifest
import hmda.model.institution.InstitutionDetail
import hmda.persistence.serialization.institution.institutiondetail.InstitutionDetailMessage
import hmda.serialization.institution.InstitutionDetailProtobufConverter._

class InstitutionDetailSerializer extends SerializerWithStringManifest {
  override def identifier: Int = 108

  final val InstitutionDetailManifest = classOf[InstitutionDetail].getName

  override def manifest(o: AnyRef): String = o.getClass.getName

  override def toBinary(o: AnyRef): Array[Byte] = o match {
    case evt: InstitutionDetail =>
      institutionDetailToProtobuf(evt).toByteArray
    case _ =>
      throw new IllegalArgumentException(
        s"Cannot serialize object of type [${o.getClass.getName}]")
  }

  override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef =
    manifest match {
      case InstitutionDetailManifest =>
        institutionDetailFromProtobuf(InstitutionDetailMessage.parseFrom(bytes))
      case _ =>
        throw new NotSerializableException(
          s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]")
    }<commit_msg>increment serialization identifier<commit_after>package hmda.serialization.institution

import java.io.NotSerializableException

import akka.serialization.SerializerWithStringManifest
import hmda.model.institution.InstitutionDetail
import hmda.persistence.serialization.institution.institutiondetail.InstitutionDetailMessage
import hmda.serialization.institution.InstitutionDetailProtobufConverter._

class InstitutionDetailSerializer extends SerializerWithStringManifest {
  override def identifier: Int = 110

  final val InstitutionDetailManifest = classOf[InstitutionDetail].getName

  override def manifest(o: AnyRef): String = o.getClass.getName

  override def toBinary(o: AnyRef): Array[Byte] = o match {
    case evt: InstitutionDetail =>
      institutionDetailToProtobuf(evt).toByteArray
    case _ =>
      throw new IllegalArgumentException(
        s"Cannot serialize object of type [${o.getClass.getName}]")
  }

  override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef =
    manifest match {
      case InstitutionDetailManifest =>
        institutionDetailFromProtobuf(InstitutionDetailMessage.parseFrom(bytes))
      case _ =>
        throw new NotSerializableException(
          s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]")
    }
{'fraction_non_alphanumeric': 0.07359141433499425, 'fraction_numerical': 0.0022997316979685703, 'mean_word_length': 5.141176470588236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1797503', 'n_tokens_mistral': 671, 'n_tokens_neox': 667, 'n_words': 156}