com.vladmihalcea.hibernate.type.array.LongArrayType Maven / Gradle / Ivy
Show all versions of hibernate-types-60 Show documentation
package com.vladmihalcea.hibernate.type.array;
import com.vladmihalcea.hibernate.type.array.internal.AbstractArrayType;
import com.vladmihalcea.hibernate.type.array.internal.LongArrayTypeDescriptor;
import com.vladmihalcea.hibernate.type.util.Configuration;
import com.vladmihalcea.hibernate.type.util.ParameterizedParameterType;
import org.hibernate.usertype.DynamicParameterizedType;
import java.util.Properties;
/**
* Maps an {@code long[]} array on a PostgreSQL ARRAY type. Multidimensional arrays are supported as well, as explained in this article.
*
* For more details about how to use it, check out this
* article on vladmihalcea.com.
*
* @author Vlad Mihalcea
*/
public class LongArrayType extends AbstractArrayType {
public static final LongArrayType INSTANCE = new LongArrayType();
public LongArrayType() {
super(
new LongArrayTypeDescriptor()
);
}
public LongArrayType(Configuration configuration) {
super(
new LongArrayTypeDescriptor(),
configuration
);
}
public LongArrayType(Class arrayClass) {
this();
Properties parameters = new Properties();
parameters.put(DynamicParameterizedType.PARAMETER_TYPE, new ParameterizedParameterType(arrayClass));
setParameterValues(parameters);
}
public LongArrayType(org.hibernate.type.spi.TypeBootstrapContext typeBootstrapContext) {
this(new Configuration(typeBootstrapContext.getConfigurationSettings()));
}
public String getName() {
return "long-array";
}
}