com.vladmihalcea.hibernate.type.basic.YearMonthIntegerType Maven / Gradle / Ivy
Show all versions of hibernate-types-60 Show documentation
package com.vladmihalcea.hibernate.type.basic;
import com.vladmihalcea.hibernate.type.MutableType;
import com.vladmihalcea.hibernate.type.basic.internal.YearMonthTypeDescriptor;
import com.vladmihalcea.hibernate.type.util.Configuration;
import org.hibernate.type.descriptor.jdbc.IntegerJdbcType;
import java.time.YearMonth;
/**
* Maps a Java {@link YearMonth} object to an {@code INT} column type.
*
* For more details about how to use it, check out this article on vladmihalcea.com.
*
* @author Vlad Mihalcea
*/
public class YearMonthIntegerType extends MutableType {
public static final YearMonthIntegerType INSTANCE = new YearMonthIntegerType();
public YearMonthIntegerType() {
super(
YearMonth.class,
IntegerJdbcType.INSTANCE,
YearMonthTypeDescriptor.INSTANCE
);
}
public YearMonthIntegerType(Configuration configuration) {
super(
YearMonth.class,
IntegerJdbcType.INSTANCE,
YearMonthTypeDescriptor.INSTANCE,
configuration
);
}
public YearMonthIntegerType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext) {
this(new Configuration(typeBootstrapContext.getConfigurationSettings()));
}
public String getName() {
return "yearmonth-int";
}
}