felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Leangen <o...@leangen.net>
Subject [Converter] Map -> Object with generics
Date Wed, 24 Aug 2016 16:21:19 GMT


I’m having a bit of trouble, so am fishing for ideas. Maybe there is a simple answer.

If I convert from Map—>DTO, and the DTO has in its tree a generic field, how can I tell
the converter the correct type so that it does not get converted as a Map?


BottomDTO {
  public String a;
  public String b;

MiddleDTO<T> {
  public T bottom;

TopDTO<T> {
  public MiddleDTO<T> middle;

If I just do this, then Map is used for the value of bottom, which will cause a ClassCastException
sometime later during execution:

  // Convert from Map to TopDTO<BottomDTO>


View raw message