com.github.jayield.rapper.mapper.externals.Foreign Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rapper Show documentation
Show all versions of rapper Show documentation
Async DataMapper for JDBC
package com.github.jayield.rapper.mapper.externals;
import com.github.jayield.rapper.DomainObject;
import com.github.jayield.rapper.unitofwork.UnitOfWork;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.function.Supplier;
public class Foreign, K> {
private final K foreignKey;
private final Function> foreignFunction;
public Foreign(K foreignKey, Function> foreignFunction) {
this.foreignKey = foreignKey;
this.foreignFunction = foreignFunction;
}
public K getForeignKey() {
return foreignKey;
}
public CompletableFuture getForeignObject(UnitOfWork unit) {
return foreignFunction.apply(unit);
}
}