org.schoellerfamily.gedbrowser.api.crud.Converter Maven / Gradle / Ivy
package org.schoellerfamily.gedbrowser.api.crud;
import java.util.List;
import org.schoellerfamily.gedbrowser.api.datamodel.ApiObject;
import org.schoellerfamily.gedbrowser.api.transformers.DocumentToApiModelTransformer;
import org.schoellerfamily.gedbrowser.persistence.domain.GedDocument;
/**
* @author Dick Schoeller
*
* @param the type to convert from
* @param the type to convert to
*/
public interface Converter, Z extends ApiObject> {
/**
* @return the class the converts from DB model to API model
*/
DocumentToApiModelTransformer getD2dm();
/**
* @param document the input document
* @return the output API document
*/
default Z convert(final Y document) {
return getD2dm().convert(document);
}
/**
* @param documents the list of input documents
* @return the output list of API documents
*/
default List convert(
final List documents) {
return getD2dm().convert(documents);
}
}