I am using the Play platform. I want to use the renderJSON function with 2 objects as an argument. This is not possible, so I am trying to create a class containing two objects. In order not to create a new class every time, I want to use Generics, but it does not work:
Model:
public class JSONContainer<T> extends Model { private T myT; private StatusMessage mySm; public JSONContainer(T myT, StatusMessage mySm) { this.myT = myT; this.mySm = mySm; } }
and then:
In the controller function:
JSONContainer<User> myJ = new JSONContainer(logged,sm); renderJSON(myJ);
where logged is User, sm is StatusMessage. I get an error message:
type: 'play.exceptions.JavaExecutionException'
If I do not use Generics, it works fine. Any idea?
The console gives this output, where line 43 is:
JSONContainer<User> myJ = new JSONContainer(logged,sm);

source share