com.vladmihalcea.hibernate.type.basic.YearType 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.YearTypeDescriptor;
import com.vladmihalcea.hibernate.type.util.Configuration;
import org.hibernate.type.descriptor.jdbc.SmallIntJdbcType;
import java.time.Year;
/**
* Maps a Java {@link Year} 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 YearType extends MutableType {
public static final YearType INSTANCE = new YearType();
public YearType() {
super(
Year.class,
SmallIntJdbcType.INSTANCE,
YearTypeDescriptor.INSTANCE
);
}
public YearType(Configuration configuration) {
super(
Year.class,
SmallIntJdbcType.INSTANCE,
YearTypeDescriptor.INSTANCE,
configuration
);
}
public YearType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext) {
this(new Configuration(typeBootstrapContext.getConfigurationSettings()));
}
public String getName() {
return "year";
}
}