Class DurationConverter
- java.lang.Object
-
- google.registry.persistence.converter.DurationConverter
-
- All Implemented Interfaces:
javax.persistence.AttributeConverter<org.joda.time.Duration,org.postgresql.util.PGInterval>
public class DurationConverter extends java.lang.Object implements javax.persistence.AttributeConverter<org.joda.time.Duration,org.postgresql.util.PGInterval>
JPA converter to for storing/retrievingDuration
objects.The Joda Time Duration is simply a number of milliseconds representing a length of time. This can be converted into a PGInterval, but only for the fields that have a standard number of milliseconds. Therefore, there is no way to populate the months or years field of a PGInterval and be confident that it is representing the exact number of milliseconds it was intended to represent.
-
-
Constructor Summary
Constructors Constructor Description DurationConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.postgresql.util.PGInterval
convertToDatabaseColumn(org.joda.time.Duration duration)
org.joda.time.Duration
convertToEntityAttribute(org.postgresql.util.PGInterval dbData)
-
-
-
Method Detail
-
convertToDatabaseColumn
@Nullable public org.postgresql.util.PGInterval convertToDatabaseColumn(@Nullable org.joda.time.Duration duration)
- Specified by:
convertToDatabaseColumn
in interfacejavax.persistence.AttributeConverter<org.joda.time.Duration,org.postgresql.util.PGInterval>
-
convertToEntityAttribute
@Nullable public org.joda.time.Duration convertToEntityAttribute(@Nullable org.postgresql.util.PGInterval dbData)
- Specified by:
convertToEntityAttribute
in interfacejavax.persistence.AttributeConverter<org.joda.time.Duration,org.postgresql.util.PGInterval>
-
-