Class DurationUserType

java.lang.Object
google.registry.persistence.converter.DurationUserType
All Implemented Interfaces:
org.hibernate.usertype.UserType<org.joda.time.Duration>

public class DurationUserType extends Object implements org.hibernate.usertype.UserType<org.joda.time.Duration>
Hibernate custom type for Duration.

Conversion of Duration is automatic. See NomulusPostgreSQLDialect for more information.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.joda.time.Duration
    assemble(Serializable serializable, Object o)
     
    static org.joda.time.Duration
    convertToDuration(org.postgresql.util.PGInterval dbData)
     
    static org.postgresql.util.PGInterval
    convertToPGInterval(org.joda.time.Duration duration)
     
    org.joda.time.Duration
    deepCopy(org.joda.time.Duration duration)
     
    disassemble(org.joda.time.Duration duration)
     
    boolean
    equals(org.joda.time.Duration duration, org.joda.time.Duration other)
     
    int
     
    int
    hashCode(org.joda.time.Duration duration)
     
    boolean
     
    org.joda.time.Duration
    nullSafeGet(ResultSet resultSet, int i, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor, Object o)
     
    void
    nullSafeSet(PreparedStatement preparedStatement, org.joda.time.Duration duration, int i, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor)
     
    Class<org.joda.time.Duration>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.hibernate.usertype.UserType

    getDefaultSqlLength, getDefaultSqlPrecision, getDefaultSqlScale, getJdbcType, getValueConverter, replace
  • Constructor Details

    • DurationUserType

      public DurationUserType()
  • Method Details

    • getSqlType

      public int getSqlType()
      Specified by:
      getSqlType in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • returnedClass

      public Class<org.joda.time.Duration> returnedClass()
      Specified by:
      returnedClass in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • equals

      public boolean equals(org.joda.time.Duration duration, org.joda.time.Duration other)
      Specified by:
      equals in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • hashCode

      public int hashCode(org.joda.time.Duration duration)
      Specified by:
      hashCode in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • nullSafeGet

      public org.joda.time.Duration nullSafeGet(ResultSet resultSet, int i, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException
      Specified by:
      nullSafeGet in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
      Throws:
      SQLException
    • nullSafeSet

      public void nullSafeSet(PreparedStatement preparedStatement, org.joda.time.Duration duration, int i, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor) throws SQLException
      Specified by:
      nullSafeSet in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
      Throws:
      SQLException
    • deepCopy

      public org.joda.time.Duration deepCopy(org.joda.time.Duration duration)
      Specified by:
      deepCopy in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • isMutable

      public boolean isMutable()
      Specified by:
      isMutable in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • disassemble

      public Serializable disassemble(org.joda.time.Duration duration)
      Specified by:
      disassemble in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • assemble

      public org.joda.time.Duration assemble(Serializable serializable, Object o)
      Specified by:
      assemble in interface org.hibernate.usertype.UserType<org.joda.time.Duration>
    • convertToPGInterval

      public static org.postgresql.util.PGInterval convertToPGInterval(org.joda.time.Duration duration)
    • convertToDuration

      @Nullable public static org.joda.time.Duration convertToDuration(org.postgresql.util.PGInterval dbData)