In some expermients I'd like to write something like this:
query(Person.class, eq(Person::lastName, "Hawking"));
where eq
method creates database query part lastName = 'Hawking'
and query
as a result return String
"SELECT * FROM person WHERE lastName = 'Hawking'"
. This way I'd be able to write type safe queries with short form and without code generation.
Problem is that eq
as first parameter takes Supplier<E>
.
Is it possible to find out via reflection API method name from passed method reference?
Even hackish way allowed! :)
Aucun commentaire:
Enregistrer un commentaire