org.hibernate.ogm.type
Class BigDecimalType

java.lang.Object
  extended by org.hibernate.ogm.type.AbstractGenericBasicType<BigDecimal>
      extended by org.hibernate.ogm.type.BigDecimalType
All Implemented Interfaces:
Serializable, GridType, StringRepresentableType<BigDecimal>, XmlRepresentableType<BigDecimal>

public class BigDecimalType
extends AbstractGenericBasicType<BigDecimal>

Type descriptor for translating a BigDecimal Java type into its string representation in order to be stored in a datastore. The BigDecimal.toString() method is used to get a string representation, this method use the standard scientific notation that should be cross platform/language usable.

Author:
Nicolas Helleringer
See Also:
BigDecimal, BigDecimal.toString(), Serialized Form

Field Summary
static BigDecimalType INSTANCE
           
 
Constructor Summary
BigDecimalType()
           
 
Method Summary
 BigDecimal fromStringValue(String string)
           
 int getColumnSpan(Mapping mapping)
          How many columns are used to persist this type.
 String getName()
          Returns the abbreviated name of the type.
protected  boolean registerUnderJavaType()
           
 String toString(BigDecimal value)
           
 
Methods inherited from class org.hibernate.ogm.type.AbstractGenericBasicType
assemble, beforeAssemble, compare, deepCopy, deepCopy, disassemble, fromString, fromXMLNode, fromXMLString, getGridTypeDescriptor, getHashCode, getHashCode, getHashCode, getJavaTypeDescriptor, getMutabilityPlan, getRegistrationKeys, getReplacement, getReturnedClass, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isDirty, isEntityType, isEqual, isEqual, isEqual, isModified, isMutable, isSame, isSame, isXMLElement, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, nullSafeSet, replace, replace, resolve, semiResolve, setToXMLNode, toColumnNullness, toLoggableString, toXMLString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final BigDecimalType INSTANCE
Constructor Detail

BigDecimalType

public BigDecimalType()
Method Detail

getName

public String getName()
Description copied from interface: GridType
Returns the abbreviated name of the type.

Returns:
String the Hibernate type name

registerUnderJavaType

protected boolean registerUnderJavaType()
Overrides:
registerUnderJavaType in class AbstractGenericBasicType<BigDecimal>

getColumnSpan

public int getColumnSpan(Mapping mapping)
                  throws MappingException
Description copied from interface: GridType
How many columns are used to persist this type. Always the same as sqlTypes(mapping).length

Specified by:
getColumnSpan in interface GridType
Specified by:
getColumnSpan in class AbstractGenericBasicType<BigDecimal>
Parameters:
mapping - The mapping object :/
Returns:
The number of columns
Throws:
MappingException - Generally indicates an issue accessing the passed mapping object.

toString

public String toString(BigDecimal value)
                throws HibernateException
Specified by:
toString in interface StringRepresentableType<BigDecimal>
Overrides:
toString in class AbstractGenericBasicType<BigDecimal>
Throws:
HibernateException

fromStringValue

public BigDecimal fromStringValue(String string)
                           throws HibernateException
Specified by:
fromStringValue in interface StringRepresentableType<BigDecimal>
Overrides:
fromStringValue in class AbstractGenericBasicType<BigDecimal>
Throws:
HibernateException


Copyright © 2010-2011 Red Hat Middleware, LLC, Emmanuel Bernard and various contributors. All Rights Reserved