Wrote OfferWriter and following classes to save offers to persistence

This commit is contained in:
Leonie Eitze
2023-06-15 18:52:06 +02:00
parent 5436118829
commit 5204cc1710
7 changed files with 227 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
package de.rwu.easydrop.service.mapping;
import de.rwu.easydrop.api.dto.OfferDTO;
import de.rwu.easydrop.model.Offer;
/**
* Maps between Offer, OfferDTO and OfferDTO.
*
* @since 0.2.0
*
* @see Offer
* @see OfferDTO
* @see OfferDTO
*/
public final class OfferMapper {
/**
* Private constructor to prevent unwanted instantiation.
*
* @throws UnsupportedOperationException always
*/
private OfferMapper() throws UnsupportedOperationException {
throw new UnsupportedOperationException("This is a mapping class, don't instantiate it.");
}
/**
* Creates a Offer object from a corresponding DTO.
*
* @param dto Offer Data Transfer Object
* @return Offer
*/
public static Offer mapOfferFromDTO(final OfferDTO dto) {
Offer offer = new Offer();
return offer;
}
/**
* Creates an OfferDTO object from a corresponding offer.
*
* @param Offer offer
* @return OfferDTO
*/
public static OfferDTO mapOfferToDTO(final Offer offer) {
OfferDTO dto = new OfferDTO(offer.getOfferId());
return dto;
}
}