io.github.mmm.orm.spi.access.DbResultReceiver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mmm-orm-spi Show documentation
Show all versions of mmm-orm-spi Show documentation
Service Provider API (SPI) for mmm-orm.
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.orm.spi.access;
import java.util.function.Consumer;
import io.github.mmm.orm.mapping.DbMapper;
import io.github.mmm.orm.mapping.DbMapper2Java;
import io.github.mmm.orm.result.DbResult;
/**
* {@link Consumer} of {@link DbResult} building the mapped Java result object.
*
* @param type of the Java result object.
* @since 1.0.0
*/
public abstract class DbResultReceiver implements Consumer {
private final DbMapper2Java mapper;
/**
* The constructor.
*
* @param mapper the {@link DbMapper}.
*/
public DbResultReceiver(DbMapper2Java mapper) {
super();
this.mapper = mapper;
}
@Override
public void accept(DbResult dbResult) {
R result = this.mapper.db2java(dbResult);
receive(result);
}
/**
* @param result the converted Java result.
*/
protected abstract void receive(R result);
}