Just reading up on spring’s data access, and it has something like this:
jdbcTemplate.query(someSql,
new Object[] { 1 },
new RowMapper() {
public Object mapRow(ResultSet rs, int rowNum) ...
Blah blah = new Blah();
blah.setId( rs.getInt(1));
}
I’m referring to the public Object mapRow part.
is this a inline class, or a callback? (or something else)
It’s a callback/upcall implemented with an anonymous inner class. “Inline class” is some made up terminology (where did it come from??).
The new version of closures that should appear in JDK7 should make this sort of thing much less verbose.
The idiom is known as Execute Around.