How to properly instantiate a Thrift/Scrooge generated class in Scala

391 Views Asked by At

I would like to instantiate a crooge generated class (or trait, better said). Now since I can't instantiate a trait, I used a anonymous wrapper class to generate some test object I want to serealize:

val err = new ClientError{}

But I cannot set any properties to this object (or at least I don't know how). What's the proper way to do this? The background is I want to create an object, serialize it, send it, deserialize it and check if it worked, if the sample has the same properties. Thanks for any help!

1

There are 1 best solutions below

2
On BEST ANSWER

There is an object ClientError, with an apply method. Just do

val err = ClientError(whatever, fields, your, thrift, struct, has)