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

uk.gov.service.payments.commons.jpa.CardExpiryDateConverter Maven / Gradle / Ivy

There is a newer version: 1.0.20241216100655
Show newest version
package uk.gov.service.payments.commons.jpa;

import uk.gov.service.payments.commons.model.CardExpiryDate;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter
public class CardExpiryDateConverter implements AttributeConverter {

    @Override
    public String convertToDatabaseColumn(CardExpiryDate cardExpiryDate) {
        if (cardExpiryDate == null) {
            return null;
        }

        return cardExpiryDate.toString();
    }

    @Override
    public CardExpiryDate convertToEntityAttribute(String cardExpiryDate) {
        if (cardExpiryDate == null) {
            return null;
        }

        return CardExpiryDate.valueOf(cardExpiryDate);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy