DATAJPA-1194 - Added missing @Override and @Nullable annotations in Jsr310JpaConverters.
Original pull request: #225.
This commit is contained in:
committed by
Oliver Gierke
parent
bb0e170a57
commit
5954530deb
@@ -35,6 +35,7 @@ import org.springframework.data.convert.Jsr310Converters.LocalDateToDateConverte
|
||||
import org.springframework.data.convert.Jsr310Converters.LocalTimeToDateConverter;
|
||||
import org.springframework.data.convert.Jsr310Converters.StringToZoneIdConverter;
|
||||
import org.springframework.data.convert.Jsr310Converters.ZoneIdToStringConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
|
||||
/**
|
||||
@@ -44,17 +45,20 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
* to be scanned on e.g. the {@link LocalContainerEntityManagerFactoryBean}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Kevin Peters
|
||||
*/
|
||||
public class Jsr310JpaConverters {
|
||||
|
||||
@Converter(autoApply = true)
|
||||
public static class LocalDateConverter implements AttributeConverter<LocalDate, Date> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(LocalDate date) {
|
||||
return date == null ? null : LocalDateToDateConverter.INSTANCE.convert(date);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LocalDate convertToEntityAttribute(Date date) {
|
||||
return date == null ? null : DateToLocalDateConverter.INSTANCE.convert(date);
|
||||
@@ -64,11 +68,13 @@ public class Jsr310JpaConverters {
|
||||
@Converter(autoApply = true)
|
||||
public static class LocalTimeConverter implements AttributeConverter<LocalTime, Date> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(LocalTime time) {
|
||||
return time == null ? null : LocalTimeToDateConverter.INSTANCE.convert(time);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LocalTime convertToEntityAttribute(Date date) {
|
||||
return date == null ? null : DateToLocalTimeConverter.INSTANCE.convert(date);
|
||||
@@ -78,11 +84,13 @@ public class Jsr310JpaConverters {
|
||||
@Converter(autoApply = true)
|
||||
public static class LocalDateTimeConverter implements AttributeConverter<LocalDateTime, Date> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(LocalDateTime date) {
|
||||
return date == null ? null : LocalDateTimeToDateConverter.INSTANCE.convert(date);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LocalDateTime convertToEntityAttribute(Date date) {
|
||||
return date == null ? null : DateToLocalDateTimeConverter.INSTANCE.convert(date);
|
||||
@@ -92,11 +100,13 @@ public class Jsr310JpaConverters {
|
||||
@Converter(autoApply = true)
|
||||
public static class InstantConverter implements AttributeConverter<Instant, Date> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(Instant instant) {
|
||||
return instant == null ? null : InstantToDateConverter.INSTANCE.convert(instant);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Instant convertToEntityAttribute(Date date) {
|
||||
return date == null ? null : DateToInstantConverter.INSTANCE.convert(date);
|
||||
@@ -106,10 +116,13 @@ public class Jsr310JpaConverters {
|
||||
@Converter(autoApply = true)
|
||||
public static class ZoneIdConverter implements AttributeConverter<ZoneId, String> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String convertToDatabaseColumn(ZoneId zoneId) {
|
||||
return zoneId == null ? null : ZoneIdToStringConverter.INSTANCE.convert(zoneId);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ZoneId convertToEntityAttribute(String zoneId) {
|
||||
return zoneId == null ? null : StringToZoneIdConverter.INSTANCE.convert(zoneId);
|
||||
|
||||
Reference in New Issue
Block a user