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

org.schoellerfamily.gedbrowser.api.crud.Converter Maven / Gradle / Ivy

There is a newer version: 1.3.0-RC2
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy