com.vladmihalcea.hibernate.type.array.BooleanArrayType Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-types-60 Show documentation
Show all versions of hibernate-types-60 Show documentation
Hibernate ORM 6.0 extra Types
package com.vladmihalcea.hibernate.type.array;
import com.vladmihalcea.hibernate.type.array.internal.AbstractArrayType;
import com.vladmihalcea.hibernate.type.array.internal.BooleanArrayTypeDescriptor;
import com.vladmihalcea.hibernate.type.util.Configuration;
import com.vladmihalcea.hibernate.type.util.ParameterizedParameterType;
import org.hibernate.type.spi.TypeBootstrapContext;
import org.hibernate.usertype.DynamicParameterizedType;
import java.util.Properties;
/**
* Maps a {@code boolean[]} array on a PostgreSQL ARRAY column type.
* For more details about how to use it, check out this article.
*
* @author [email protected]
* @version 2.9.13
*/
public class BooleanArrayType extends AbstractArrayType {
public static final BooleanArrayType INSTANCE = new BooleanArrayType();
public BooleanArrayType() {
super(
new BooleanArrayTypeDescriptor()
);
}
public BooleanArrayType(Configuration configuration) {
super(
new BooleanArrayTypeDescriptor(),
configuration
);
}
public BooleanArrayType(Class arrayClass) {
this();
Properties parameters = new Properties();
parameters.put(DynamicParameterizedType.PARAMETER_TYPE, new ParameterizedParameterType(arrayClass));
setParameterValues(parameters);
}
public BooleanArrayType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext) {
this(new Configuration(typeBootstrapContext.getConfigurationSettings()));
}
public String getName() {
return "boolean-array";
}
}