All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.orm.spi.access.DbResultReceiver Maven / Gradle / Ivy

There is a newer version: 0.9.8
Show newest version
/* 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);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy