-
Notifications
You must be signed in to change notification settings - Fork 199
/
CassandraYesNoType.java
36 lines (30 loc) · 1.05 KB
/
CassandraYesNoType.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.ogm.datastore.cassandra.type.impl;
import org.hibernate.MappingException;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.ogm.type.descriptor.impl.StringMappedGridTypeDescriptor;
import org.hibernate.ogm.type.impl.AbstractGenericBasicType;
/**
* Maps {@link Boolean} to {@code Y} or {@code N} strings.
*
* @author Davide D'Alto
*/
public class CassandraYesNoType extends AbstractGenericBasicType<Boolean> {
public static final CassandraYesNoType INSTANCE = new CassandraYesNoType();
public CassandraYesNoType() {
super( StringMappedGridTypeDescriptor.INSTANCE, org.hibernate.type.YesNoType.INSTANCE.getJavaTypeDescriptor() );
}
@Override
public int getColumnSpan(Mapping mapping) throws MappingException {
return 1;
}
@Override
public String getName() {
return "yes_no";
}
}