com.atlassian.crowd.util.persistence.hibernate
Class BooleanStringUserType

java.lang.Object
  extended by org.hibernate.type.AbstractStandardBasicType<T>
      extended by org.hibernate.type.AbstractSingleColumnStandardBasicType<Boolean>
          extended by com.atlassian.crowd.util.persistence.hibernate.BooleanStringUserType
All Implemented Interfaces:
Serializable, org.hibernate.type.BasicType, org.hibernate.type.DiscriminatorType<Boolean>, org.hibernate.type.IdentifierType<Boolean>, org.hibernate.type.LiteralType<Boolean>, org.hibernate.type.PrimitiveType<Boolean>, org.hibernate.type.SingleColumnType<Boolean>, org.hibernate.type.StringRepresentableType<Boolean>, org.hibernate.type.Type, org.hibernate.type.XmlRepresentableType<Boolean>

public class BooleanStringUserType
extends org.hibernate.type.AbstractSingleColumnStandardBasicType<Boolean>
implements org.hibernate.type.PrimitiveType<Boolean>, org.hibernate.type.DiscriminatorType<Boolean>

Boolean implementation that allows us to store Booleans as "true" and "false".

For Hibernate 4 this type has been reimplemented as a AbstractSingleColumnStandardBasicType, as it is no longer possible to change the true and false strings for CharBooleanType. Due to the short-sighted way Hibernate's BooleanType is implemented, this class cannot extend from that, because that class explicitly references Hibernate's BooleanTypeDescriptor, which only uses "T" or "F" for its value, rather than the whole word as required by this type.

See Also:
BooleanTypeDescriptor, Serialized Form

Constructor Summary
BooleanStringUserType()
           
 
Method Summary
 Serializable getDefaultValue()
           
 String getName()
           
 Class getPrimitiveClass()
           
 String objectToSQLString(Boolean value, org.hibernate.dialect.Dialect dialect)
           
 Boolean stringToObject(String xml)
           
 
Methods inherited from class org.hibernate.type.AbstractSingleColumnStandardBasicType
nullSafeSet, sqlType
 
Methods inherited from class org.hibernate.type.AbstractStandardBasicType
assemble, beforeAssemble, compare, deepCopy, deepCopy, defaultSizes, dictatedSizes, disassemble, fromString, fromStringValue, fromXMLNode, fromXMLString, get, getColumnSpan, getDefaultSize, getDictatedSize, getHashCode, getHashCode, getJavaTypeDescriptor, getMutabilityPlan, getRegistrationKeys, getReplacement, getReturnedClass, getSemiResolvedType, getSqlTypeDescriptor, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, isXMLElement, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, registerUnderJavaType, remapSqlTypeDescriptor, replace, replace, resolve, semiResolve, set, setJavaTypeDescriptor, setSqlTypeDescriptor, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString, toString, toXMLString
 
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.PrimitiveType
toString
 
Methods inherited from interface org.hibernate.type.Type
assemble, beforeAssemble, compare, deepCopy, defaultSizes, dictatedSizes, disassemble, fromXMLNode, getColumnSpan, getHashCode, getHashCode, getReturnedClass, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, isXMLElement, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, resolve, semiResolve, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString
 
Methods inherited from interface org.hibernate.type.SingleColumnType
fromStringValue, get, nullSafeGet, set, toString
 

Constructor Detail

BooleanStringUserType

public BooleanStringUserType()
Method Detail

getDefaultValue

public Serializable getDefaultValue()
Specified by:
getDefaultValue in interface org.hibernate.type.PrimitiveType<Boolean>

getName

public String getName()
Specified by:
getName in interface org.hibernate.type.Type

getPrimitiveClass

public Class getPrimitiveClass()
Specified by:
getPrimitiveClass in interface org.hibernate.type.PrimitiveType<Boolean>

objectToSQLString

public String objectToSQLString(Boolean value,
                                org.hibernate.dialect.Dialect dialect)
                         throws Exception
Specified by:
objectToSQLString in interface org.hibernate.type.LiteralType<Boolean>
Throws:
Exception

stringToObject

public Boolean stringToObject(String xml)
                       throws Exception
Specified by:
stringToObject in interface org.hibernate.type.IdentifierType<Boolean>
Throws:
Exception


Copyright © 2014 Atlassian. All Rights Reserved.