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

generator.server.springboot.database.redis.JSR310DateConverters.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.wire.redis.infrastructure.secondary;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import org.springframework.core.convert.converter.Converter;

/**
 * 

JSR310DateConverters class.

*/ public final class JSR310DateConverters { private JSR310DateConverters() {} @SuppressWarnings("java:S6548") public static final class ZonedDateTimeToDateConverter implements Converter { public static final ZonedDateTimeToDateConverter INSTANCE = new ZonedDateTimeToDateConverter(); private ZonedDateTimeToDateConverter() {} @Override public Date convert(ZonedDateTime source) { return Date.from(source.toInstant()); } } @SuppressWarnings("java:S6548") public static final class DateToZonedDateTimeConverter implements Converter { public static final DateToZonedDateTimeConverter INSTANCE = new DateToZonedDateTimeConverter(); private DateToZonedDateTimeConverter() {} @Override public ZonedDateTime convert(Date source) { return ZonedDateTime.ofInstant(source.toInstant(), ZoneId.systemDefault()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy