Reputation: 4171
In the IntelliJ editor, there's an SQL inspection that inspects Strings containing queries and highlight as errors unresolved references.
I have generic methods used to build queries (it's part of a home-brewed framework I have to work with) that I'd like to use something similar to SQL inspection on.
Here's a method signature that allows to select entities:
// find all entityClass matching the given filters
public <E> List<E> findAllBy(Class<E> entityClass, Filter... filter);
and here is an example of method that allows to specify a Filter object.
// param is the name of the field of entityClass, value is the value it should take
public static Filter equals(String param,Object value);
My question is the following:
Is it possible to define, in IntelliJ an inspection that would check that the value of param correspond to a field well defined in entityClass ?
Bonus Question:
Is it possible to handle param of the form "foo.foo2" that would refer to the value foo2 of the object referenced by the field foo of object entityClass ?
Upvotes: 0
Views: 30