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, Iván García Sáinz-Aja

Field Summary
protected  PBEStringEncryptor encryptor
           
 
Constructor Summary
AbstractEncryptedAsStringType()
           
 
Method Summary
 Object assemble(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)
           
 Serializable disassemble(Object value)
           
 boolean equals(Object x, Object y)
           
 int hashCode(Object x)
           
 boolean isMutable()
           
 Object nullSafeGet(ResultSet rs, String[] names, Object owner)
           
 void nullSafeSet(PreparedStatement st, Object value, int index)
           
 Object replace(Object original, Object target, Object owner)
           
abstract  Class returnedClass()
           
 void setParameterValues(Properties parameters)
           
 int[] sqlTypes()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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 final 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 final 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 final Object deepCopy(Object value)
                      throws org.hibernate.HibernateException
Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException

assemble

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

disassemble

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

isMutable

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

hashCode

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

replace

public final 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 final Object nullSafeGet(ResultSet rs,
                                String[] names,
                                Object owner)
                         throws org.hibernate.HibernateException,
                                SQLException
Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException

nullSafeSet

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

setParameterValues

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

checkInitialization

protected final void checkInitialization()


Copyright © 2011 The JASYPT team. All Rights Reserved.