TypedQueryHandler<E>#

com.palmyralabs.palmyra.handlers.TypedQueryHandler

Standalone generic interface for type-safe row callbacks.

Methods#

Method Signature
onQueryResult void onQueryResult(E e)

Use it when you want strongly-typed access to mapped rows rather than working with Tuple.

Example#

@Component
public class UserAuditHandler implements TypedQueryHandler<User> {

    private final List<User> audit = new ArrayList<>();

    @Override
    public void onQueryResult(User user) {
        // collect active users for an out-of-band audit feed
        if ("ACTIVE".equals(user.getStatus())) {
            audit.add(user);
        }
    }
}