io.bitexpress.topia.commons.data.supplier.ModelSupplier Maven / Gradle / Ivy
package io.bitexpress.topia.commons.data.supplier;
import java.io.Serializable;
import java.util.function.Supplier;
import org.springframework.data.repository.CrudRepository;
public class ModelSupplier implements Supplier {
private CrudRepository crudRepository;
private KEY id;
public ModelSupplier(CrudRepository crudRepository, KEY id) {
this.crudRepository = crudRepository;
this.id = id;
}
@Override
public MODEL get() {
return crudRepository.findById(id).orElse(null);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy