This method involves a bit more code but i think it's your best bet :
@Override
public List<Interface> findAllWithFilters(String name, InterfaceType type, String ip)
{
Interface intfc = new Interface();
intfc.setName(name);
intfc.setType(type);
intfc.setIp(ip);
ExampleMatcher matcher = ExampleMatcher.matching()
.withMatcher("name", match -> match.contains())
.withMatcher("type", match -> match.exact())
.withMatcher("ip", match -> match.contains())
.withIgnorePaths("id", "uuid")
.withIgnoreNullValues();
Example<Interface> example = Example.of(intfc, matcher);
return ((InterfaceRepository) baseRepository).findAll(example);
}
The .withIgnoreNullValues() is the key. It will just return everything if you send a null value instead of an enum constant.