org.jasypt.hibernate.type
Class AbstractEncryptedAsStringType

Object
  extended by org.jasypt.hibernate.type.AbstractEncryptedAsStringType
All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType
Direct Known Subclasses:
EncryptedBigDecimalAsStringType, EncryptedBigIntegerAsStringType, EncryptedBooleanAsStringType, EncryptedByteAsStringType, EncryptedCalendarAsStringType, EncryptedDateAsStringType, EncryptedDoubleAsStringType, EncryptedFloatAsStringType, EncryptedIntegerAsStringType, EncryptedLongAsStringType, EncryptedShortAsStringType, EncryptedStringType

public abstract class AbstractEncryptedAsStringType
extends Object
implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType

Base class for Hibernate 3 UserTypes to store values as encrypted strings.

Since:
1.2
Author:
Daniel Fernández Garrido, Iván García Sáinz-Aja

Field Summary
protected  PBEStringEncryptor encryptor
           
protected static org.hibernate.type.NullableType nullableType
           
protected static int sqlType
           
protected static int[] sqlTypes
           
 
Constructor Summary
AbstractEncryptedAsStringType()
           
 
Method Summary
 Object assemble(java.io.Serializable cached, Object owner)
           
protected  void checkInitialization()
           
protected abstract  Object convertToObject(String string)
          Converts given String to its Object form.
protected  String convertToString(Object object)
          Converts given Object to its String form.
 Object deepCopy(Object value)
           
 java.io.Serializable disassemble(Object value)
           
 boolean equals(Object x, Object y)
           
 int hashCode(Object x)
           
 boolean isMutable()
           
 Object nullSafeGet(java.sql.ResultSet rs, String[] names, Object owner)
           
 void nullSafeSet(java.sql.PreparedStatement st, Object value, int index)
           
 Object replace(Object original, Object target, Object owner)
           
abstract  Class returnedClass()
           
 void setParameterValues(java.util.Properties parameters)
           
 int[] sqlTypes()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nullableType

protected static org.hibernate.type.NullableType nullableType

sqlType

protected static int sqlType

sqlTypes

protected static int[] sqlTypes

encryptor

protected PBEStringEncryptor encryptor
Constructor Detail

AbstractEncryptedAsStringType

public AbstractEncryptedAsStringType()
Method Detail

convertToObject

protected abstract Object convertToObject(String string)
Converts given String to its Object form.

Parameters:
string - the string value
Returns:
the object form of the passed String

convertToString

protected String convertToString(Object object)
Converts given Object to its String form.

Parameters:
object - the object value
Returns:
the string form of the passes Object

sqlTypes

public int[] sqlTypes()
Specified by:
sqlTypes in interface org.hibernate.usertype.UserType

returnedClass

public abstract Class returnedClass()
Specified by:
returnedClass in interface org.hibernate.usertype.UserType

equals

public boolean equals(Object x,
                      Object y)
               throws org.hibernate.HibernateException
Specified by:
equals in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

deepCopy

public Object deepCopy(Object value)
                throws org.hibernate.HibernateException
Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

assemble

public Object assemble(java.io.Serializable cached,
                       Object owner)
                throws org.hibernate.HibernateException
Specified by:
assemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

disassemble

public java.io.Serializable disassemble(Object value)
                                 throws org.hibernate.HibernateException
Specified by:
disassemble in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

isMutable

public boolean isMutable()
Specified by:
isMutable in interface org.hibernate.usertype.UserType

hashCode

public int hashCode(Object x)
             throws org.hibernate.HibernateException
Specified by:
hashCode in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

replace

public Object replace(Object original,
                      Object target,
                      Object owner)
               throws org.hibernate.HibernateException
Specified by:
replace in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

nullSafeGet

public Object nullSafeGet(java.sql.ResultSet rs,
                          String[] names,
                          Object owner)
                   throws org.hibernate.HibernateException,
                          java.sql.SQLException
Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement st,
                        Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        java.sql.SQLException
Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
java.sql.SQLException

setParameterValues

public void setParameterValues(java.util.Properties parameters)
Specified by:
setParameterValues in interface org.hibernate.usertype.ParameterizedType

checkInitialization

protected void checkInitialization()


Copyright © 2008 The JASYPT team. All Rights Reserved.