1

Assuming I have a class named User, can I register a codec for a collection of Users?

I tried using just this:

eb.registerDefaultCodec(List<User>::class.java, User.UserListCodec())

But it produces this error: Only classes are allowed on the left hand side of a class literal.

art-solopov
  • 4,289
  • 3
  • 25
  • 44
  • 1
    You can't unfortunately. You must either create a `UserList` object or simply get the message as a buffer and convert with Jackson type ref (see similar issue with WebClient https://stackoverflow.com/a/53812159/2133695). In Vert.x 4 this shall be addressed. – tsegismont Jan 04 '19 at 09:31

1 Answers1

0

You could try using arrayListOf(...)

eb.registerDefaultCodec(arrayListOf<User>()::class.java, User.UserListCodec())
munyengm
  • 15,029
  • 4
  • 24
  • 34