This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
avihai marchiano wrote:I am not sure its not possible.
He has another question.
The main difference between the other question and your question, is that the other question actually doesn't know the type of elements in the collection that is passed into the method.
With your question, you actually know that it is a Criteria<ItemTO> instance, so you know it is the ItemTO.class object that you want. And can just specify it iin source. No need to search based on the Criteria object.
Now, if you don't want to define the ItemTO.class in source, but want to search based on the Criteria<ItemTO> instance, then you have the same issue as the other question.
Java Generic is of a type erasure. this is done for backwards compatibility. this means that you won't be able to code it to know the class of T during runtime in your Generic class. not sure this is related what you are looking for, but hope this will help a bit.