Reputation: 187
Playing with QueryDSL library.
Found interesting function
public static <T> ArrayConstructorExpression<T> array(Class<T[]> type, Expression... exprs)
I've never seen such a Generic as mentioned above. How can I pass the first parameter there?
Googling last hour, but no result for now.
Upvotes: 4
Views: 1107
Reputation: 34460
Assuming T
is of class Integer
, you can do as follows:
ArrayConstructorExpression<Integer> arr = array(Integer[].class, someExpression);
There's no magic here. Integer[].class
is the class that represents arrays of Integer
objects.
Upvotes: 8