lift - Generic types inside List in Scala -


I placed on the following:

  Val serializedClasses: List [MongoMetaRecord [MongoRecord [_ Unfortunately I can not know the exact type of elements and may have the following code fails:  
  serializedClasses map (c = & gt; new RecordSerializer (c)) [error] JsonFormats. Scala: 19: inferred type arguments [_ $ 1] The type of class RecordSerializer does not conform to the parameter range [TK <: net.liftweb.mongodb.record. MongoRecord [t]] [ERROR] contained Val jsonformats = DefaultFormats + (new ObjectIdSerializer) + (New RecordSerializer (DirectMessage)) + (new RecordSerializer (user)) ++ serializedClasses.map (c = & gt; New RecordSerializer (c) )  

RecordSerializer.scala

  Object RecordSerializer {def applied [tk <: MongoRecord [t]] (meta: MongoMetaRecord [T]) = new Rikardsiriyalaijhr (meta)} class Rikordsirilaijhr [T & lt;: MongoRecord [T]] (meta: Mong oMetaRecord [t]) extends Serializer [MongoRecord [T]] {def Deserialize (built-in format: format): PartialFunction [[TypeInfo, JValue], MongoRecord [T]] = {Ma Met (TypeInfo (clazz, parametrizedType), json: JValue) if (Jesnformetssirilaijd Clasesnamoncenttents (Clajkgetsnplnam)) = & gt; } Def sequentially (format contained format): {meta.fromJValue (JSON) .openOr (New MappingException (could not be changed "") throw)} PartialFunction [any, JValue] = {case REC: MongoRecord [_] = & Gt; Rec.asJValue}} 

I do not know what the question is here. How to compile it? RecordSerializer takes a type mongorecord and your list does not capture the type of its items. If you want to get it to work, you will either need to capture the record type (you can use an HList provided by mourning to occupy the type of item) or you The record serializer must be rewritten so that it only gets information from the record on the runtime and is not dependent on knowing the compilation time type.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -