Author: steve.ebersole(a)jboss.com
Date: 2010-05-02 20:04:27 -0400 (Sun, 02 May 2010)
New Revision: 19345
Added:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java
Removed:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java
Modified:
core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java
core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java
core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java
Log:
HHH-5138 - Redesign types + introduce TypeRegistry & TypeResolver
Modified:
core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/AbstractSingleColumnStandardBasicType.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -31,8 +31,8 @@
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.NonContextualLobCreator;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
/**
Modified: core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -40,9 +40,9 @@
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.jdbc.LobCreator;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.descriptor.java.MutabilityPlan;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.util.ArrayHelper;
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/BinaryStream.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,47 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor;
+
+import java.io.InputStream;
+
+/**
+ * Wraps a binary stream to also provide the length which is needed when binding.
+ *
+ * @author Steve Ebersole
+ */
+public interface BinaryStream {
+ /**
+ * Retrieve the input stream.
+ *
+ * @return The input stream
+ */
+ public InputStream getInputStream();
+
+ /**
+ * Retrieve the length of the input stream
+ *
+ * @return The input stream length
+ */
+ public int getLength();
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/CharacterStream.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor;
+
+import java.io.Reader;
+
+/**
+ * Wraps a character stream (reader) to also provide the length (number of characters)
which is needed
+ * when binding.
+ *
+ * @author Steve Ebersole
+ */
+public interface CharacterStream {
+ /**
+ * Retrieve the reader.
+ *
+ * @return The reader.
+ */
+ public Reader getReader();
+
+ /**
+ * Retrieve the number of characters. JDBC 3 and earlier defined the length in terms of
int type rather than
+ * long type :(
+ *
+ * @return The number of characters.
+ */
+ public int getLength();
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueBinder.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,46 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+/**
+ * Contract for binding values to a {@link PreparedStatement}.
+ *
+ * @author Steve Ebersole
+ */
+public interface ValueBinder<X> {
+ /**
+ * Bind a value to a prepared statement.
+ *
+ * @param st The prepared statement to which to bind the value.
+ * @param value The value to bind.
+ * @param index The position at which to bind the value within the prepared statement
+ * @param options The options.
+ *
+ * @throws SQLException Indicates a JDBC error occurred.
+ */
+ public void bind(PreparedStatement st, X value, int index, WrapperOptions options)
throws SQLException;
+}
Added: core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/ValueExtractor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,47 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * Contract for extracting a value from a {@link ResultSet}.
+ *
+ * @author Steve Ebersole
+ */
+public interface ValueExtractor<X> {
+ /**
+ * Extract value from result set
+ *
+ * @param rs The result set from which to extract the value
+ * @param name The name by which to extract the value from the result set
+ * @param options The options
+ *
+ * @return The extracted value
+ *
+ * @throws SQLException Indicates a JDBC error occurred.
+ */
+ public X extract(ResultSet rs, String name, WrapperOptions options) throws
SQLException;
+}
Copied: core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java
(from rev 19335,
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java)
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/WrapperOptions.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,36 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor;
+
+import org.hibernate.engine.jdbc.LobCreator;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public interface WrapperOptions {
+ public boolean useStreamForLobBinding();
+ public LobCreator getLobCreator();
+}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link BigDecimal} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link BigInteger} handling.
*
Added:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BinaryStreamImpl.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,52 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor.java;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.hibernate.type.descriptor.BinaryStream;
+
+/**
+ * Implementation of {@link BinaryStream}
+ *
+ * @author Steve Ebersole
+ */
+public class BinaryStreamImpl implements BinaryStream {
+ private final ByteArrayInputStream stream;
+ private final int length;
+
+ public BinaryStreamImpl(byte[] bytes) {
+ this.stream = new ByteArrayInputStream( bytes );
+ this.length = bytes.length;
+ }
+
+ public InputStream getInputStream() {
+ return stream;
+ }
+
+ public int getLength() {
+ return length;
+ }
+}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BlobTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.BlobProxy;
import org.hibernate.engine.jdbc.WrappedBlob;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Blob} handling.
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/BooleanTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
import static java.lang.Boolean.TRUE;
import static java.lang.Boolean.FALSE;
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteArrayTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,6 +29,8 @@
import java.sql.SQLException;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -86,6 +88,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( unwrapBytes( value ) );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( unwrapBytes( value ) );
+ }
if ( Blob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createBlob( unwrapBytes( value ) );
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ByteTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Byte} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,6 +29,7 @@
import java.util.GregorianCalendar;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.CalendarComparator;
/**
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CalendarTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,6 +29,7 @@
import java.util.GregorianCalendar;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.CalendarComparator;
/**
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterArrayTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -84,6 +86,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( new String( unwrapChars( value ) ) );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( new String( unwrapChars( value ) ) );
+ }
throw unknownUnwrap( type );
}
Added:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java
(rev 0)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterStreamImpl.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -0,0 +1,52 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type.descriptor.java;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.hibernate.type.descriptor.CharacterStream;
+
+/**
+ * Implementation of {@link CharacterStream}
+ *
+ * @author Steve Ebersole
+ */
+public class CharacterStreamImpl implements CharacterStream {
+ private final StringReader reader;
+ private final int length;
+
+ public CharacterStreamImpl(String chars) {
+ reader = new StringReader( chars );
+ length = chars.length();
+ }
+
+ public Reader getReader() {
+ return reader;
+ }
+
+ public int getLength() {
+ return length;
+ }
+}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CharacterTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -24,7 +24,7 @@
package org.hibernate.type.descriptor.java;
import org.hibernate.HibernateException;
-import org.hibernate.MappingException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Character} handling.
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClassTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -24,6 +24,7 @@
package org.hibernate.type.descriptor.java;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.ReflectHelper;
/**
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ClobTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import org.hibernate.HibernateException;
import org.hibernate.engine.jdbc.ClobProxy;
import org.hibernate.engine.jdbc.WrappedClob;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Clob} handling.
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/CurrencyTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -25,6 +25,8 @@
import java.util.Currency;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DateTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,6 +30,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/DoubleTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Double} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/FloatTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Float} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/IntegerTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Integer} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.io.Serializable;
import java.util.Comparator;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for the Java side of a value mapping.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcDateTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,6 +30,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -31,6 +31,7 @@
import java.util.GregorianCalendar;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -32,6 +32,7 @@
import org.hibernate.HibernateException;
import org.hibernate.cfg.Environment;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LocaleTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -27,6 +27,8 @@
import java.util.Locale;
import java.util.StringTokenizer;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/LongTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Long} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveByteArrayTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@code byte[]} handling.
@@ -97,6 +99,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( value );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( value );
+ }
if ( Blob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createBlob( value );
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/PrimitiveCharacterArrayTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,6 +30,8 @@
import java.util.Arrays;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* TODO : javadoc
@@ -84,6 +86,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( new String( value ) );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( new String( value ) );
+ }
throw unknownUnwrap( type );
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -27,6 +27,8 @@
import java.io.InputStream;
import java.io.Serializable;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.util.SerializationHelper;
/**
@@ -85,6 +87,9 @@
if ( InputStream.class.isAssignableFrom( type ) ) {
return (X) new ByteArrayInputStream( toBytes( value ) );
}
+ if ( BinaryStream.class.isAssignableFrom( type ) ) {
+ return (X) new BinaryStreamImpl( toBytes( value ) );
+ }
throw unknownUnwrap( type );
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/ShortTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -23,6 +23,8 @@
*/
package org.hibernate.type.descriptor.java;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* Descriptor for {@link Short} handling.
*
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/StringTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,6 +29,8 @@
import java.sql.SQLException;
import org.hibernate.HibernateException;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link String} handling.
@@ -61,6 +63,9 @@
if ( Reader.class.isAssignableFrom( type ) ) {
return (X) new StringReader( (String) value );
}
+ if ( CharacterStream.class.isAssignableFrom( type ) ) {
+ return (X) new CharacterStreamImpl( (String) value );
+ }
if ( Clob.class.isAssignableFrom( type ) ) {
return (X) options.getLobCreator().createClob( value );
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/TimeZoneTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -26,6 +26,8 @@
import java.util.Comparator;
import java.util.TimeZone;
+import org.hibernate.type.descriptor.WrapperOptions;
+
/**
* TODO : javadoc
*
Deleted:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/WrapperOptions.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -1,36 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.type.descriptor.java;
-
-import org.hibernate.engine.jdbc.LobCreator;
-
-/**
- * TODO : javadoc
- *
- * @author Steve Ebersole
- */
-public interface WrapperOptions {
- public boolean useStreamForLobBinding();
- public LobCreator getLobCreator();
-}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicBinder.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,17 +29,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
-import static org.hibernate.type.descriptor.sql.SqlTypeDescriptor.Binder;
-
/**
- * Convenience base implementation of {@link Binder}
+ * Convenience base implementation of {@link ValueBinder}
*
* @author Steve Ebersole
*/
-public abstract class BasicBinder<J> implements Binder<J> {
+public abstract class BasicBinder<J> implements ValueBinder<J> {
private static final Logger log = LoggerFactory.getLogger( BasicBinder.class );
private final JavaTypeDescriptor<J> javaDescriptor;
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BasicExtractor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,17 +29,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
-import static org.hibernate.type.descriptor.sql.SqlTypeDescriptor.Extractor;
-
/**
- * Convenience base implementation of {@link Extractor}
+ * Convenience base implementation of {@link
org.hibernate.type.descriptor.ValueExtractor}
*
* @author Steve Ebersole
*/
-public abstract class BasicExtractor<J> implements Extractor<J> {
+public abstract class BasicExtractor<J> implements ValueExtractor<J> {
private static final Logger log = LoggerFactory.getLogger( BasicExtractor.class );
private final JavaTypeDescriptor<J> javaDescriptor;
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BigIntTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#BIGINT BIGINT} handling.
@@ -43,7 +45,7 @@
return Types.BIGINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BitTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#BIT BIT} handling.
@@ -46,7 +48,7 @@
return Types.BIT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -55,7 +57,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/BlobTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,8 +30,11 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.BinaryStream;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#BLOB BLOB} handling.
@@ -45,12 +48,13 @@
return Types.BLOB;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
if ( options.useStreamForLobBinding() ) {
- st.setBinaryStream( index, getJavaDescriptor().unwrap( value, InputStream.class,
options ) );
+ final BinaryStream binaryStream = javaTypeDescriptor.unwrap( value,
BinaryStream.class, options );
+ st.setBinaryStream( index, binaryStream.getInputStream(), binaryStream.getLength()
);
}
else {
st.setBlob( index, javaTypeDescriptor.unwrap( value, Blob.class, options ) );
@@ -59,7 +63,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/ClobTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -30,8 +30,11 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.CharacterStream;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#CLOB CLOB} handling.
@@ -45,12 +48,13 @@
return Types.CLOB;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
if ( options.useStreamForLobBinding() ) {
- st.setCharacterStream( index, getJavaDescriptor().unwrap( value, Reader.class,
options ) );
+ final CharacterStream characterStream = javaTypeDescriptor.unwrap( value,
CharacterStream.class, options );
+ st.setCharacterStream( index, characterStream.getReader(),
characterStream.getLength() );
}
else {
st.setClob( index, javaTypeDescriptor.unwrap( value, Clob.class, options ) );
@@ -59,7 +63,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DateTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#DATE DATE} handling.
@@ -44,7 +46,7 @@
return Types.DATE;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DecimalTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#DECIMAL DECIMAL} handling.
@@ -44,7 +46,7 @@
return Types.DECIMAL;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/DoubleTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#DOUBLE DOUBLE} handling.
@@ -43,7 +45,7 @@
return Types.DOUBLE;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/IntegerTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#INTEGER INTEGER} handling.
@@ -43,7 +45,7 @@
return Types.INTEGER;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/RealTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#REAL REAL} handling.
@@ -43,7 +45,7 @@
return Types.REAL;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SmallIntTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#SMALLINT SMALLINT} handling.
@@ -43,7 +45,7 @@
return Types.SMALLINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/SqlTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -24,12 +24,10 @@
package org.hibernate.type.descriptor.sql;
import java.io.Serializable;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for the <tt>SQL</tt>/<tt>JDBC</tt> side of a value
mapping.
@@ -44,15 +42,7 @@
*/
public int getSqlType();
- public static interface Binder<X> {
- public void bind(PreparedStatement st, X value, int index, WrapperOptions options)
throws SQLException;
- }
+ public <X> ValueBinder<X> getBinder(JavaTypeDescriptor<X>
javaTypeDescriptor);
- public <X> Binder<X> getBinder(JavaTypeDescriptor<X>
javaTypeDescriptor);
-
- public static interface Extractor<X> {
- public X extract(ResultSet rs, String name, WrapperOptions options) throws
SQLException;
- }
-
- public <X> Extractor<X> getExtractor(JavaTypeDescriptor<X>
javaTypeDescriptor);
+ public <X> ValueExtractor<X> getExtractor(JavaTypeDescriptor<X>
javaTypeDescriptor);
}
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimeTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.Time;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#TIME TIME} handling.
@@ -44,7 +46,7 @@
return Types.TIME;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TimestampTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -29,8 +29,10 @@
import java.sql.Timestamp;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
+import org.hibernate.type.descriptor.WrapperOptions;
/**
* Descriptor for {@link Types#TIMESTAMP TIMESTAMP} handling.
@@ -44,7 +46,7 @@
return Types.TIMESTAMP;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -53,7 +55,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/TinyIntTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#TINYINT TINYINT} handling.
@@ -46,7 +48,7 @@
return Types.TINYINT;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -55,7 +57,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarbinaryTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#VARBINARY VARBINARY} handling.
@@ -43,7 +45,7 @@
return Types.VARBINARY;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/sql/VarcharTypeDescriptor.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -28,8 +28,10 @@
import java.sql.SQLException;
import java.sql.Types;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
/**
* Descriptor for {@link Types#VARCHAR VARCHAR} handling.
@@ -43,7 +45,7 @@
return Types.VARCHAR;
}
- public <X> Binder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicBinder<X>( javaTypeDescriptor, this ) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions
options) throws SQLException {
@@ -52,7 +54,7 @@
};
}
- public <X> Extractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
+ public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X>
javaTypeDescriptor) {
return new BasicExtractor<X>( javaTypeDescriptor, this ) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws
SQLException {
Modified:
core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java
===================================================================
---
core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java 2010-05-02
15:32:40 UTC (rev 19344)
+++
core/trunk/core/src/test/java/org/hibernate/type/descriptor/sql/StringValueMappingTest.java 2010-05-03
00:04:27 UTC (rev 19345)
@@ -32,10 +32,11 @@
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.NonContextualLobCreator;
+import org.hibernate.type.descriptor.ValueBinder;
+import org.hibernate.type.descriptor.ValueExtractor;
+import org.hibernate.type.descriptor.WrapperOptions;
import org.hibernate.type.descriptor.java.StringTypeDescriptor;
-import org.hibernate.type.descriptor.java.WrapperOptions;
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
-import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
/**
@@ -63,8 +64,8 @@
public static final int BIND_POSITION = -1;
public void testNormalVarcharHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor =
varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = varcharSqlDescriptor.getBinder(
stringJavaDescriptor );
+ final ValueExtractor<String> extractor = varcharSqlDescriptor.getExtractor(
stringJavaDescriptor );
+ final ValueBinder<String> binder = varcharSqlDescriptor.getBinder(
stringJavaDescriptor );
final String fixture = "string value";
@@ -77,8 +78,8 @@
}
public void testNullVarcharHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor =
varcharSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = varcharSqlDescriptor.getBinder(
stringJavaDescriptor );
+ final ValueExtractor<String> extractor = varcharSqlDescriptor.getExtractor(
stringJavaDescriptor );
+ final ValueBinder<String> binder = varcharSqlDescriptor.getBinder(
stringJavaDescriptor );
final String fixture = null;
@@ -91,8 +92,8 @@
}
public void testNormalClobHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor =
clobSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = clobSqlDescriptor.getBinder(
stringJavaDescriptor );
+ final ValueExtractor<String> extractor = clobSqlDescriptor.getExtractor(
stringJavaDescriptor );
+ final ValueBinder<String> binder = clobSqlDescriptor.getBinder(
stringJavaDescriptor );
final String fixture = "clob string";
final Clob clob = new StringClobImpl( fixture );
@@ -106,8 +107,8 @@
}
public void testNullClobHandling() throws SQLException {
- final SqlTypeDescriptor.Extractor<String> extractor =
clobSqlDescriptor.getExtractor( stringJavaDescriptor );
- final SqlTypeDescriptor.Binder<String> binder = clobSqlDescriptor.getBinder(
stringJavaDescriptor );
+ final ValueExtractor<String> extractor = clobSqlDescriptor.getExtractor(
stringJavaDescriptor );
+ final ValueBinder<String> binder = clobSqlDescriptor.getBinder(
stringJavaDescriptor );
final String fixture = null;
final Clob clob = null;