Author: steve.ebersole(a)jboss.com
Date: 2010-05-12 15:48:43 -0400 (Wed, 12 May 2010)
New Revision: 19483
Modified:
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java
Log:
HHH-5138 - Redesign types + introduce TypeRegistry & TypeResolver
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-12
19:12:12 UTC (rev 19482)
+++
core/trunk/core/src/main/java/org/hibernate/type/descriptor/java/SerializableTypeDescriptor.java 2010-05-12
19:48:43 UTC (rev 19483)
@@ -37,18 +37,33 @@
* @author Steve Ebersole
*/
public class SerializableTypeDescriptor<T extends Serializable> extends
AbstractTypeDescriptor<T> {
+
// unfortunately the param types cannot be the same so use something other than
'T' here to make that obvious
public static class SerializableMutabilityPlan<S extends Serializable> extends
MutableMutabilityPlan<S> {
- public static final SerializableMutabilityPlan INSTANCE = new
SerializableMutabilityPlan();
+ private final Class<S> type;
+
+ public static final SerializableMutabilityPlan<Serializable> INSTANCE
+ = new SerializableMutabilityPlan<Serializable>( Serializable.class );
+
+ public SerializableMutabilityPlan(Class<S> type) {
+ this.type = type;
+ }
+
@SuppressWarnings({ "unchecked" })
public S deepCopyNotNull(S value) {
return (S) SerializationHelper.clone( value );
}
+
}
@SuppressWarnings({ "unchecked" })
public SerializableTypeDescriptor(Class<T> type) {
- super( type, SerializableMutabilityPlan.INSTANCE );
+ super(
+ type,
+ Serializable.class.equals( type )
+ ? (MutabilityPlan<T>) SerializableMutabilityPlan.INSTANCE
+ : new SerializableMutabilityPlan<T>( type )
+ );
}
public String toString(T value) {
Show replies by date