I want to create a specific generic method in Scala. It takes two parameters. The first is a generic Java interface type (it is from a JPA criteria request). Currently, it looks like this:
def genericFind(attribute:SingularAttribute[Person, _], value:Object) {
...
}
public interface SingularAttribute<X, T> extends Attribute<X, T>, Bindable<T>
Now I want to achieve the following: The value is currently of type java.lang.Object. But I want to make it more specific. The value must be of the same type as the placeholder "_" from the first parameter (and therefore represents "T" in the Java interface).
How is this possible and how?
BTW Sorry for the stupid question (any suggestions?)
EDIT:
Added an additional example that can make the problem clearer:
public class Person_ {
public static volatile SingularAttribute<Person, Long> id;
}
genericFind(Person_.id, Long)