Wrote OfferWriter and following classes to save offers to persistence
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user