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

de.bund.bva.isyfact.persistence.datetime.attributeconverter.PeriodAttributeConverter Maven / Gradle / Ivy

The newest version!
package de.bund.bva.isyfact.persistence.datetime.attributeconverter;

import java.time.Period;
import java.util.Objects;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * {@link javax.persistence.AttributeConverter} für {@link Period}.
 * 

* Das Speichern erfolgt in der ISO-8601-Darstellung als String. * */ @Converter(autoApply = true) public class PeriodAttributeConverter implements AttributeConverter { @Override public String convertToDatabaseColumn(Period period) { return Objects.toString(period, null); } @Override public Period convertToEntityAttribute(String aString) { if (aString == null) { return null; } return Period.parse(aString); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy