本文整理汇总了Scala中akka.serialization.SerializerWithStringManifest类的典型用法代码示例。如果您正苦于以下问题:Scala SerializerWithStringManifest类的具体用法?Scala SerializerWithStringManifest怎么用?Scala SerializerWithStringManifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SerializerWithStringManifest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: HmdaFilingViewProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.query.serialization
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.model.serialization.HmdaFilingViewState.FilingViewStateMessage
import hmda.query.view.filing.HmdaFilingView.FilingViewState
import hmda.query.serialization.HmdaFilingViewProtobufConverter._
class HmdaFilingViewProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1012
override def manifest(o: AnyRef): String = o.getClass.getName
final val FilingViewStateManifest = classOf[FilingViewState].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case state: FilingViewState => filingViewStateToProtobuf(state).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case FilingViewStateManifest =>
filingViewStateFromProtobuf(FilingViewStateMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例2: InstitutionViewProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.query.serialization
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.model.serialization.InstitutionViewEvents.InstitutionViewStateMessage
import hmda.query.view.institutions.InstitutionView.InstitutionViewState
import hmda.query.serialization.InstitutionViewProtobufConverter._
class InstitutionViewProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1011
override def manifest(o: AnyRef): String = o.getClass.getName
final val InstitutionViewStateManifest = classOf[InstitutionViewState].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case state: InstitutionViewState => institutionViewStateToProtobuf(state).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case InstitutionViewStateManifest =>
institutionViewStateFromProtobuf(InstitutionViewStateMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例3: InstitutionProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.institutions
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.institutions.InstitutionEvents.{ InstitutionCreated, InstitutionModified }
import hmda.persistence.model.serialization.InstitutionEvents.{ InstitutionCreatedMessage, InstitutionModifiedMessage }
import hmda.persistence.serialization.institutions.InstitutionProtobufConverter._
class InstitutionProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1000
override def manifest(o: AnyRef): String = o.getClass.getName
final val InstitutionCreatedManifest = classOf[InstitutionCreated].getName
final val InstitutionModifiedManifest = classOf[InstitutionModified].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: InstitutionCreated => institutionCreatedToProtobuf(evt).toByteArray
case evt: InstitutionModified => institutionModifiedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case InstitutionCreatedManifest =>
institutionCreatedFromProtobuf(InstitutionCreatedMessage.parseFrom(bytes))
case InstitutionModifiedManifest =>
institutionModifiedFromProtobuf(InstitutionModifiedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例4: FilingProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.filing
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.institutions.FilingEvents.{ FilingCreated, FilingStatusUpdated }
import hmda.persistence.model.serialization.FilingEvents.{ FilingCreatedMessage, FilingStatusUpdatedMessage }
import hmda.persistence.serialization.filing.FilingProtobufConverter._
class FilingProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1002
override def manifest(o: AnyRef): String = o.getClass.getName
final val FilingCreatedManifest = classOf[FilingCreated].getName
final val FilingStatusUpdatedManifest = classOf[FilingStatusUpdated].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: FilingCreated => filingCreatedToProtobuf(evt).toByteArray
case evt: FilingStatusUpdated => filingStatusUpdatedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case FilingCreatedManifest =>
filingCreatedFromProtobuf(FilingCreatedMessage.parseFrom(bytes))
case FilingStatusUpdatedManifest =>
filingStatusUpdatedFromProtobuf(FilingStatusUpdatedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例5: HmdaFileParserProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.parser
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.processing.HmdaFileParserEvents._
import hmda.persistence.model.serialization.HmdaFileParserEvents._
import hmda.persistence.serialization.parser.HmdaFileParserProtobufConverter._
class HmdaFileParserProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1003
override def manifest(o: AnyRef): String = o.getClass.getName
final val TsParsedManifest = classOf[TsParsed].getName
final val TsParsedErrorsManifest = classOf[TsParsedErrors].getName
final val LarParsedManifest = classOf[LarParsed].getName
final val LarParsedErrorsManifest = classOf[LarParsedErrors].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case event: TsParsed => tsParsedToProtobuf(event).toByteArray
case event: TsParsedErrors => tsParsedErrorsToProtobuf(event).toByteArray
case event: LarParsed => larParsedToProtobuf(event).toByteArray
case event: LarParsedErrors => larParsedErrorsToProtobuf(event).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize message: $msg")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case TsParsedManifest => tsParsedFromProtobuf(TsParsedMessage.parseFrom(bytes))
case TsParsedErrorsManifest => tsParsedErrorsFromProtobuf(TsParsedErrorsMessage.parseFrom(bytes))
case LarParsedManifest => larParsedFromProtobuf(LarParsedMessage.parseFrom(bytes))
case LarParsedErrorsManifest => larParsedErrorsFromProtobuf(LarParsedErrorsMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize message: $msg")
}
}
示例6: UploadProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.upload
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.processing.FileUploadEvents.{ FileNameAdded, LineAdded }
import hmda.persistence.model.serialization.FileUpload.{ FileNameAddedMessage, LineAddedMessage }
import hmda.persistence.serialization.upload.UploadProtobufConverter._
class UploadProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1005
override def manifest(o: AnyRef): String = o.getClass.getName
final val LineAddedManifest = classOf[LineAdded].getName
final val FileNameAddedManifest = classOf[FileNameAdded].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: LineAdded => lineAddedToProtobuf(evt).toByteArray
case evt: FileNameAdded => fileNameAddedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case LineAddedManifest =>
lineAddedFromProtobuf(LineAddedMessage.parseFrom(bytes))
case FileNameAddedManifest =>
fileNameAddedFromProtobuf(FileNameAddedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例7: HmdaValidatorProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.validation
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.processing.CommonHmdaValidatorEvents.{ LarValidated, TsValidated }
import hmda.persistence.model.serialization.CommonHmdaValidator.{ LarValidatedMessage, TsValidatedMessage }
import hmda.persistence.serialization.validation.HmdaValidatorProtobufConverter._
class HmdaValidatorProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1004
override def manifest(o: AnyRef): String = o.getClass.getName
final val LarValidatedManifest = classOf[LarValidated].getName
final val TsValidatedManifest = classOf[TsValidated].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: LarValidated => larValidatedToProtobuf(evt).toByteArray
case evt: TsValidated => tsValidatedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case LarValidatedManifest =>
larValidatedFromProtobuf(LarValidatedMessage.parseFrom(bytes))
case TsValidatedManifest =>
tsValidatedFromProtobuf(TsValidatedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例8: HmdaFileValidatorProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.validation
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.processing.HmdaFileValidatorEvents._
import hmda.persistence.model.serialization.HmdaFileValidatorEvents._
import hmda.persistence.serialization.validation.HmdaFileValidatorProtobufConverter._
class HmdaFileValidatorProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1006
override def manifest(o: AnyRef): String = o.getClass.getName
final val EditsVerifiedManifest = classOf[EditsVerified].getName
final val TsSyntacticalErrorManifest = classOf[TsSyntacticalError].getName
final val TsValidityErrorManifest = classOf[TsValidityError].getName
final val TsQualityErrorManifest = classOf[TsQualityError].getName
final val LarSyntacticalErrorManifest = classOf[LarSyntacticalError].getName
final val LarValidityErrorManifest = classOf[LarValidityError].getName
final val LarQualityErrorManifest = classOf[LarQualityError].getName
final val LarMacroErrorManifest = classOf[LarMacroError].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: EditsVerified => editsVerifiedToProtobuf(evt).toByteArray
case evt: TsSyntacticalError => tsSyntacticalErrorToProtobuf(evt).toByteArray
case evt: TsValidityError => tsValidityErrorToProtobuf(evt).toByteArray
case evt: TsQualityError => tsQualityErrorToProtobuf(evt).toByteArray
case evt: LarSyntacticalError => larSyntacticalErrorToProtobuf(evt).toByteArray
case evt: LarValidityError => larValidityErrorToProtobuf(evt).toByteArray
case evt: LarQualityError => larQualityErrorToProtobuf(evt).toByteArray
case evt: LarMacroError => larMacroErrorToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize message $msg")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case EditsVerifiedManifest => editsVerifiedFromProtobuf(EditsVerifiedMessage.parseFrom(bytes))
case TsSyntacticalErrorManifest => tsSyntacticalErrorFromProtobuf(TsSyntacticalErrorMessage.parseFrom(bytes))
case TsValidityErrorManifest => tsValidityErrorFromProtobuf(TsValidityErrorMessage.parseFrom(bytes))
case TsQualityErrorManifest => tsQualityErrorFromProtobuf(TsQualityErrorMessage.parseFrom(bytes))
case LarSyntacticalErrorManifest => larSyntacticalErrorFromProtobuf(LarSyntacticalErrorMessage.parseFrom(bytes))
case LarValidityErrorManifest => larValidityErrorFromProtobuf(LarValidityErrorMessage.parseFrom(bytes))
case LarQualityErrorManifest => larQualityErrorFromProtobuf(LarQualityErrorMessage.parseFrom(bytes))
case LarMacroErrorManifest => larMacroErrorFromProtobuf(LarMacroErrorMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize message $msg")
}
}
示例9: ValidationStatsProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.validation
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.validation.ValidationStatsEvents._
import hmda.persistence.model.serialization.ValidationStatsEvents._
import hmda.persistence.serialization.validation.ValidationStatsProtobufConverter._
class ValidationStatsProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1008
override def manifest(o: AnyRef): String = o.getClass.getName
final val SubmissionSubmittedTotalsAddedManifest = classOf[SubmissionSubmittedTotalsAdded].getName
final val SubmissionTaxIdAddedManifest = classOf[SubmissionTaxIdAdded].getName
final val SubmissionMacroStatsAddedManifest = classOf[SubmissionMacroStatsAdded].getName
final val IrsStatsAddedManifest = classOf[IrsStatsAdded].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: SubmissionSubmittedTotalsAdded => submissionSubmittedTotalsAddedToProtobuf(evt).toByteArray
case evt: SubmissionTaxIdAdded => submissionTaxIdAddedToProtobuf(evt).toByteArray
case evt: SubmissionMacroStatsAdded => submissionMacroStatsAddedToProtobuf(evt).toByteArray
case evt: IrsStatsAdded => irsStatsAddedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize message $msg")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case SubmissionSubmittedTotalsAddedManifest =>
submissionSubmittedTotalsAddedFromProtobuf(SubmissionSubmittedTotalsAddedMessage.parseFrom(bytes))
case SubmissionTaxIdAddedManifest =>
submissionTaxIdAddedFromProtobuf(SubmissionTaxIdAddedMessage.parseFrom(bytes))
case SubmissionMacroStatsAddedManifest =>
submissionMacroStatsAddedFromProtobuf(SubmissionMacroStatsAddedMessage.parseFrom(bytes))
case IrsStatsAddedManifest =>
irsStatsAddedFromProtobuf(IrsStatsAddedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize message $msg")
}
}
示例10: SubmissionLarStatsProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.validation
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.validation.SubmissionLarStatsEvents.{ IrsStatsUpdated, MacroStatsUpdated, SubmittedLarsUpdated }
import hmda.persistence.model.serialization.SubmissionLarStatsEvents.{ IrsStatsUpdatedMessage, MacroStatsUpdatedMessage, SubmittedLarsUpdatedMessage }
import hmda.persistence.serialization.validation.SubmissionLarStatsProtobufConverter._
class SubmissionLarStatsProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1007
override def manifest(o: AnyRef): String = o.getClass.getName
final val SubmittedLarsUpdatedManifest = classOf[SubmittedLarsUpdated].getName
final val MacroStatsUpdatedManifest = classOf[MacroStatsUpdated].getName
final val IrsStatsUpdatedManifest = classOf[IrsStatsUpdated].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: SubmittedLarsUpdated => submittedLarsUpdatedToProtobuf(evt).toByteArray
case evt: MacroStatsUpdated => macroStatsUpdatedToProtobuf(evt).toByteArray
case evt: IrsStatsUpdated => irsStatsUpdatedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case SubmittedLarsUpdatedManifest =>
submittedLarsUpdatedFromProtobuf(SubmittedLarsUpdatedMessage.parseFrom(bytes))
case MacroStatsUpdatedManifest =>
macroStatsUpdatedFromProtobuf(MacroStatsUpdatedMessage.parseFrom(bytes))
case IrsStatsUpdatedManifest =>
irsStatsUpdatedFromProtobuf(IrsStatsUpdatedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例11: SubmissionProtobufSerializer
//设置package包名称以及导入依赖的类
package hmda.persistence.serialization.submission
import akka.serialization.SerializerWithStringManifest
import hmda.persistence.messages.events.institutions.SubmissionEvents.{ SubmissionCreated, SubmissionStatusUpdated }
import hmda.persistence.model.serialization.SubmissionEvents.{ SubmissionCreatedMessage, SubmissionStatusUpdatedMessage }
import hmda.persistence.serialization.submission.SubmissionProtobufConverter._
class SubmissionProtobufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 1001
override def manifest(o: AnyRef): String = o.getClass.getName
final val SubmissionCreatedManifest = classOf[SubmissionCreated].getName
final val SubmissionStatusUpdatedManifest = classOf[SubmissionStatusUpdated].getName
override def toBinary(o: AnyRef): Array[Byte] = o match {
case evt: SubmissionCreated => submissionCreatedToProtobuf(evt).toByteArray
case evt: SubmissionStatusUpdated => submissionStatusUpdatedToProtobuf(evt).toByteArray
case msg: Any => throw new RuntimeException(s"Cannot serialize this message: ${msg.toString}")
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = manifest match {
case SubmissionCreatedManifest =>
submissionCreatedFromProtobuf(SubmissionCreatedMessage.parseFrom(bytes))
case SubmissionStatusUpdatedManifest =>
submissionStatusUpdatedFromProtobuf(SubmissionStatusUpdatedMessage.parseFrom(bytes))
case msg: Any => throw new RuntimeException(s"Cannot deserialize this message: ${msg.toString}")
}
}
示例12: FlightLastKnownPaxProtoBufSerializer
//设置package包名称以及导入依赖的类
package actors.serializers
import akka.serialization.SerializerWithStringManifest
import server.protobuf.messages.FlightsMessage.FlightLastKnownPaxMessage
class FlightLastKnownPaxProtoBufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 9005
override def manifest(targetObject: AnyRef): String = {
targetObject.getClass.getName
}
final val manifestName = classOf[FlightLastKnownPaxMessage].getName
override def toBinary(objectToSerialize: AnyRef): Array[Byte] = {
objectToSerialize match {
case sms: FlightLastKnownPaxMessage => sms.toByteArray
}
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = {
manifest match {
case `manifestName` => FlightLastKnownPaxMessage.parseFrom(bytes)
}
}
}
开发者ID:UKHomeOffice,项目名称:drt-scalajs-spa-exploration,代码行数:27,代码来源:FlightLastKnownPaxProtoBufSerializer.scala
示例13: FlightsProtoBufSerializer
//设置package包名称以及导入依赖的类
package actors.serializers
import akka.serialization.SerializerWithStringManifest
import server.protobuf.messages.FlightsMessage.FlightsMessage
import server.protobuf.messages.StaffMovementMessages.StaffMovementsMessage
class FlightsProtoBufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 9002
override def manifest(targetObject: AnyRef): String = {
targetObject.getClass.getName
}
final val manifestName = classOf[FlightsMessage].getName
override def toBinary(objectToSerialize: AnyRef): Array[Byte] = {
objectToSerialize match {
case sms: FlightsMessage => sms.toByteArray
}
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = {
manifest match {
case `manifestName` => FlightsMessage.parseFrom(bytes)
}
}
}
示例14: ShiftsProtoBufSerializer
//设置package包名称以及导入依赖的类
package actors.serializers
import akka.serialization.SerializerWithStringManifest
import server.protobuf.messages.ShiftMessage.ShiftsMessage
class ShiftsProtoBufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 9003
override def manifest(targetObject: AnyRef): String = {
targetObject.getClass.getName
}
final val ShiftsManifest = classOf[ShiftsMessage].getName
override def toBinary(objectToSerialize: AnyRef): Array[Byte] = {
objectToSerialize match {
case sm: ShiftsMessage => sm.toByteArray
}
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = {
manifest match {
case ShiftsManifest => ShiftsMessage.parseFrom(bytes)
}
}
}
示例15: FlightStateSnapshotProtoBufSerializer
//设置package包名称以及导入依赖的类
package actors.serializers
import akka.serialization.SerializerWithStringManifest
import server.protobuf.messages.FlightsMessage.FlightStateSnapshotMessage
class FlightStateSnapshotProtoBufSerializer extends SerializerWithStringManifest {
override def identifier: Int = 9004
override def manifest(targetObject: AnyRef): String = {
targetObject.getClass.getName
}
final val manifestName = classOf[FlightStateSnapshotMessage].getName
override def toBinary(objectToSerialize: AnyRef): Array[Byte] = {
objectToSerialize match {
case sms: FlightStateSnapshotMessage => sms.toByteArray
}
}
override def fromBinary(bytes: Array[Byte], manifest: String): AnyRef = {
manifest match {
case `manifestName` => FlightStateSnapshotMessage.parseFrom(bytes)
}
}
}
开发者ID:UKHomeOffice,项目名称:drt-scalajs-spa-exploration,代码行数:27,代码来源:FlightStateSnapshotProtoBufSerializer.scala