1 package com.vladmihalcea.hibernate.type.basic;
2
3 import com.vladmihalcea.hibernate.type.AbstractHibernateType;
4 import com.vladmihalcea.hibernate.type.basic.internal.MonthDayTypeDescriptor;
5 import com.vladmihalcea.hibernate.type.util.Configuration;
6 import org.hibernate.type.descriptor.sql.DateTypeDescriptor;
7 import org.hibernate.type.descriptor.sql.IntegerTypeDescriptor;
8
9 import java.time.MonthDay;
10
11 /**
12  * Maps a Java {@link java.time.MonthDay} object to a {@code INT} column type.
13  *
14  * @author Mladen Savic (mladensavic94@gmail.com)
15  */

16 public class MonthDayIntegerType extends AbstractHibernateType<MonthDay> {
17
18     public static final MonthDayIntegerType INSTANCE = new MonthDayIntegerType();
19
20
21     public MonthDayIntegerType() {
22         super(IntegerTypeDescriptor.INSTANCE, MonthDayTypeDescriptor.INSTANCE);
23     }
24
25     public MonthDayIntegerType(Configuration configuration) {
26         super(IntegerTypeDescriptor.INSTANCE, MonthDayTypeDescriptor.INSTANCE, configuration);
27     }
28
29     @Override
30     public String getName() {
31         return "monthday-int";
32     }
33
34     @Override
35     protected boolean registerUnderJavaType() {
36         return true;
37     }
38 }
39