public class PostgreSQLGuavaRangeType extends ImmutableType<com.google.common.collect.Range> implements org.hibernate.usertype.DynamicParameterizedType
Range object type to a PostgreSQL range
column type.
Supported range types:
| Modifier and Type | Class and Description |
|---|---|
static interface |
PostgreSQLGuavaRangeType.Function<T,R> |
| Modifier and Type | Field and Description |
|---|---|
static PostgreSQLGuavaRangeType |
INSTANCE |
| Constructor and Description |
|---|
PostgreSQLGuavaRangeType() |
| Modifier and Type | Method and Description |
|---|---|
String |
asString(com.google.common.collect.Range range) |
static com.google.common.collect.Range<BigDecimal> |
bigDecimalRange(String range)
Creates the
BigDecimal range from provided string: |
protected com.google.common.collect.Range |
get(ResultSet rs,
String[] names,
org.hibernate.engine.spi.SessionImplementor session,
Object owner)
Get the column value from the JDBC
ResultSet. |
Class<?> |
getElementType() |
static com.google.common.collect.Range<Integer> |
integerRange(String range)
Creates the
Integer range from provided string: |
static com.google.common.collect.Range<Long> |
longRange(String range)
Creates the
Long range from provided string: |
static <T extends Comparable> |
ofString(String str,
PostgreSQLGuavaRangeType.Function<String,T> converter,
Class<T> cls) |
protected void |
set(PreparedStatement st,
com.google.common.collect.Range range,
int index,
org.hibernate.engine.spi.SessionImplementor session)
Set the column value on the provided JDBC
PreparedStatement. |
void |
setParameterValues(Properties parameters) |
int[] |
sqlTypes() |
assemble, assemble, beforeAssemble, compare, deepCopy, deepCopy, defaultSizes, dictatedSizes, disassemble, disassemble, equals, getColumnSpan, getConfiguration, getHashCode, getHashCode, getName, getRegistrationKeys, getReturnedClass, getSemiResolvedType, hashCode, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, replace, resolve, returnedClass, semiResolve, sqlTypes, toColumnNullness, toLoggableStringpublic static final PostgreSQLGuavaRangeType INSTANCE
public int[] sqlTypes()
sqlTypes in interface org.hibernate.usertype.UserTypeprotected com.google.common.collect.Range get(ResultSet rs, String[] names, org.hibernate.engine.spi.SessionImplementor session, Object owner) throws SQLException
ImmutableTypeResultSet.get in class ImmutableType<com.google.common.collect.Range>rs - JDBC ResultSetnames - database column namesession - current Hibernate Sessionowner - current Hibernate SessionFactorySQLException - in case of failureprotected void set(PreparedStatement st, com.google.common.collect.Range range, int index, org.hibernate.engine.spi.SessionImplementor session) throws SQLException
ImmutableTypePreparedStatement.set in class ImmutableType<com.google.common.collect.Range>st - JDBC PreparedStatementrange - database column valueindex - database column indexsession - current Hibernate SessionSQLException - in case of failurepublic static <T extends Comparable> com.google.common.collect.Range<T> ofString(String str, PostgreSQLGuavaRangeType.Function<String,T> converter, Class<T> cls)
public static com.google.common.collect.Range<BigDecimal> bigDecimalRange(String range)
BigDecimal range from provided string:
Range<BigDecimal> closed = Range.bigDecimalRange("[0.1,1.1]");
Range<BigDecimal> halfOpen = Range.bigDecimalRange("(0.1,1.1]");
Range<BigDecimal> open = Range.bigDecimalRange("(0.1,1.1)");
Range<BigDecimal> leftUnbounded = Range.bigDecimalRange("(,1.1)");
range - The range string, for example "[5.5,7.8]".BigDecimals.NumberFormatException - when one of the bounds are invalid.public static com.google.common.collect.Range<Integer> integerRange(String range)
Integer range from provided string:
Range<Integer> closed = Range.integerRange("[1,5]");
Range<Integer> halfOpen = Range.integerRange("(-1,1]");
Range<Integer> open = Range.integerRange("(1,2)");
Range<Integer> leftUnbounded = Range.integerRange("(,10)");
Range<Integer> unbounded = Range.integerRange("(,)");
range - The range string, for example "[5,7]".Integers.NumberFormatException - when one of the bounds are invalid.public static com.google.common.collect.Range<Long> longRange(String range)
Long range from provided string:
Range<Long> closed = Range.longRange("[1,5]");
Range<Long> halfOpen = Range.longRange("(-1,1]");
Range<Long> open = Range.longRange("(1,2)");
Range<Long> leftUnbounded = Range.longRange("(,10)");
Range<Long> unbounded = Range.longRange("(,)");
range - The range string, for example "[5,7]".Longs.NumberFormatException - when one of the bounds are invalid.public String asString(com.google.common.collect.Range range)
public void setParameterValues(Properties parameters)
setParameterValues in interface org.hibernate.usertype.ParameterizedTypepublic Class<?> getElementType()
Copyright © 2023. All rights reserved.