org.hibernate.type.descriptor.java
Class AbstractTypeDescriptor<T>

java.lang.Object
  extended by org.hibernate.type.descriptor.java.AbstractTypeDescriptor<T>
All Implemented Interfaces:
Serializable, JavaTypeDescriptor<T>
Direct Known Subclasses:
BigDecimalTypeDescriptor, BigIntegerTypeDescriptor, BlobTypeDescriptor, BooleanTypeDescriptor, ByteArrayTypeDescriptor, ByteTypeDescriptor, CalendarDateTypeDescriptor, CalendarTypeDescriptor, CharacterArrayTypeDescriptor, CharacterTypeDescriptor, ClassTypeDescriptor, ClobTypeDescriptor, CurrencyTypeDescriptor, DateTypeDescriptor, DoubleTypeDescriptor, FloatTypeDescriptor, IntegerTypeDescriptor, JdbcDateTypeDescriptor, JdbcTimestampTypeDescriptor, JdbcTimeTypeDescriptor, LocaleTypeDescriptor, LongTypeDescriptor, PrimitiveByteArrayTypeDescriptor, PrimitiveCharacterArrayTypeDescriptor, SerializableTypeDescriptor, ShortTypeDescriptor, StringTypeDescriptor, TimeZoneTypeDescriptor, UrlTypeDescriptor, UUIDTypeDescriptor

public abstract class AbstractTypeDescriptor<T>
extends Object
implements JavaTypeDescriptor<T>, Serializable

Abstract adapter for Java type descriptors.

Author:
Steve Ebersole
See Also:
Serialized Form

Constructor Summary
protected AbstractTypeDescriptor(Class<T> type)
          Initialize a type descriptor for the given type.
protected AbstractTypeDescriptor(Class<T> type, MutabilityPlan<T> mutabilityPlan)
          Initialize a type descriptor for the given type.
 
Method Summary
 boolean areEqual(T one, T another)
          Determine if two instances are equal
 int extractHashCode(T value)
          Extract a proper hash code for this value.
 String extractLoggableRepresentation(T value)
          Extract a loggable representation of the value.
 Comparator<T> getComparator()
          Retrieve the natural comparator for this type.
 Class<T> getJavaTypeClass()
          Retrieve the Java type handled here.
 MutabilityPlan<T> getMutabilityPlan()
          Retrieve the mutability plan for this Java type.
protected  HibernateException unknownUnwrap(Class conversionType)
           
protected  HibernateException unknownWrap(Class conversionType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.type.descriptor.java.JavaTypeDescriptor
fromString, toString, unwrap, wrap
 

Constructor Detail

AbstractTypeDescriptor

protected AbstractTypeDescriptor(Class<T> type)
Initialize a type descriptor for the given type. Assumed immutable.

Parameters:
type - The Java type.
See Also:
AbstractTypeDescriptor(Class, MutabilityPlan)

AbstractTypeDescriptor

protected AbstractTypeDescriptor(Class<T> type,
                                 MutabilityPlan<T> mutabilityPlan)
Initialize a type descriptor for the given type. Assumed immutable.

Parameters:
type - The Java type.
mutabilityPlan - The plan for handling mutability aspects of the java type.
Method Detail

getMutabilityPlan

public MutabilityPlan<T> getMutabilityPlan()
Retrieve the mutability plan for this Java type.

Specified by:
getMutabilityPlan in interface JavaTypeDescriptor<T>
Returns:
The mutability plan

getJavaTypeClass

public Class<T> getJavaTypeClass()
Retrieve the Java type handled here.

Specified by:
getJavaTypeClass in interface JavaTypeDescriptor<T>
Returns:
The Java type.

extractHashCode

public int extractHashCode(T value)
Extract a proper hash code for this value.

Specified by:
extractHashCode in interface JavaTypeDescriptor<T>
Parameters:
value - The value for which to extract a hash code.
Returns:
The extracted hash code.

areEqual

public boolean areEqual(T one,
                        T another)
Determine if two instances are equal

Specified by:
areEqual in interface JavaTypeDescriptor<T>
Parameters:
one - One instance
another - The other instance
Returns:
True if the two are considered equal; false otherwise.

getComparator

public Comparator<T> getComparator()
Retrieve the natural comparator for this type.

Specified by:
getComparator in interface JavaTypeDescriptor<T>
Returns:
The natural comparator.

extractLoggableRepresentation

public String extractLoggableRepresentation(T value)
Extract a loggable representation of the value.

Specified by:
extractLoggableRepresentation in interface JavaTypeDescriptor<T>
Parameters:
value - The value for which to extract a loggable representation.
Returns:
The loggable representation

unknownUnwrap

protected HibernateException unknownUnwrap(Class conversionType)

unknownWrap

protected HibernateException unknownWrap(Class conversionType)


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.