![JAR search and dependency download from the Maven repository](/logo.png)
scala.class_impls_read.ssp Maven / Gradle / Ivy
The newest version!
<%@ val cls: com.foursquare.spindle.codegen.runtime.StructLike %>
override def read(iprot: org.apache.thrift.protocol.TProtocol) {
// Unknown fields in this read go here.
var currentUnknownFieldsOpt: Option[com.foursquare.spindle.runtime.UnknownFields] = None
def currentUnknownFields(): com.foursquare.spindle.runtime.UnknownFields = currentUnknownFieldsOpt match {
case Some(uf) => uf
case None => {
val uf = new com.foursquare.spindle.runtime.UnknownFields(
this,
com.foursquare.spindle.runtime.TProtocolInfo.getProtocolName(iprot)
)
unknownFields = uf :: unknownFields
currentUnknownFieldsOpt = Some(uf)
uf
}
}
iprot.readStructBegin()
var wire_field_header: org.apache.thrift.protocol.TField = iprot.readFieldBegin()
while (wire_field_header.`type` != org.apache.thrift.protocol.TType.STOP) {
// Some protocols, e.g., BSON and JSON, serialize the field name, not the id. If we don't have the id we use the
// name to look up the id and type. This allows us to use those protocols naturally.
var field_header: org.apache.thrift.protocol.TField = if (wire_field_header.id < 0) {
${cls.name}.wireNameToTField.getOrElse(wire_field_header.name, wire_field_header)
} else {
wire_field_header
}
try {
field_header.id match {
#for (field <- cls.fields)
case ${field.identifier} => { // ${field.name}
#if (field.renderType.isEnum)
if (field_header.`type` == org.apache.thrift.protocol.TType.${field.renderType.ttype.name} || field_header.`type` == org.apache.thrift.protocol.TType.ENUM) {
#else
if (field_header.`type` == org.apache.thrift.protocol.TType.${field.renderType.ttype.name}) {
#end
<% render(field.renderType.fieldReadTemplate, Map("renderType" -> field.renderType, "lhs" -> (field.varName + " ="), "indent" -> " ")) %>
#if (field.renderType.usesSetVar)
${field.isSetVar} = true
#end
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field_header.`type`)
}
}
#end
case _ => {
if (com.foursquare.spindle.RuntimeHelpers.preserveUnknownFields(this)) {
currentUnknownFields().readUnknownField(iprot, field_header, this) // May call this method recursively.
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field_header.`type`)
}
}
} // end match
} catch {
case e: org.apache.thrift.TException =>
throw new org.apache.thrift.TException("Error reading field %d in structure ${cls.name}".format(field_header.id), e)
}
iprot.readFieldEnd()
wire_field_header = iprot.readFieldBegin()
} // end while
iprot.readStructEnd()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy