org.hibernate.type.descriptor.java
Interface JavaTypeDescriptor<T>

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractTypeDescriptor, 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 interface JavaTypeDescriptor<T>
extends Serializable

Descriptor for the Java side of a value mapping.

Author:
Steve Ebersole

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.
 T fromString(String string)
           
 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.
 String toString(T value)
           
<X> X
unwrap(T value, Class<X> type, WrapperOptions options)
          Unwrap an instance of our handled Java type into the requested type.
<X> T
wrap(X value, WrapperOptions options)
          Wrap a value as our handled Java type.
 

Method Detail

getJavaTypeClass

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

Returns:
The Java type.

getMutabilityPlan

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

Returns:
The mutability plan

getComparator

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

Returns:
The natural comparator.

extractHashCode

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

Parameters:
value - The value for which to extract a hash code.
Returns:
The extracted hash code.

areEqual

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

Parameters:
one - One instance
another - The other instance
Returns:
True if the two are considered equal; false otherwise.

extractLoggableRepresentation

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

Parameters:
value - The value for which to extract a loggable representation.
Returns:
The loggable representation

toString

String toString(T value)

fromString

T fromString(String string)

unwrap

<X> X unwrap(T value,
             Class<X> type,
             WrapperOptions options)
Unwrap an instance of our handled Java type into the requested type.

As an example, if this is a JavaTypeDescriptor<Integer> and we are asked to unwrap the Integer value as a Long we would return something like Long.valueOf( value.longValue() ).

Intended use is during PreparedStatement binding.

Type Parameters:
X - The conversion type.
Parameters:
value - The value to unwrap
type - The type as which to unwrap
options - The options
Returns:
The unwrapped value.

wrap

<X> T wrap(X value,
           WrapperOptions options)
Wrap a value as our handled Java type.

Intended use is during ResultSet extraction.

Type Parameters:
X - The conversion type.
Parameters:
value - The value to wrap.
options - The options
Returns:
The wrapped value.


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