If an exception should be ignored inside a method call, one would write eg the following:
public void addEntryIfPresent(String key, Dto dto) {
try {
Map<String, Object> row = database.queryForMap(key);
dto.entry.put(row);
} catch (EmptyResultDataAccessException e) {}
}
I'm trying to write eg a custom spring
annotation that has the same effect, but could just be applied to the method header. That could look similar to the following:
@IgnoreException(EmptyResultDataAccessException.class) //this annotation does not exist
public void addEntryIfPresent(String key, Dto dto) {
Map<String, Object> row = database.queryForMap(key);
dto.entry.put(row);
}
How could such an annotation be created?