com.elasticpath.persistence.support.impl
Class UserPermissionType

java.lang.Object
  extended by com.elasticpath.persistence.support.impl.UserPermissionType
All Implemented Interfaces:
java.io.Serializable, org.hibernate.usertype.UserType

public class UserPermissionType
extends java.lang.Object
implements org.hibernate.usertype.UserType, java.io.Serializable

This class defines a Hibernate customer value type UserPermission. This is the type of the component objects of a collection property in UserRole.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
UserPermissionType()
           
 
Method Summary
 java.lang.Object assemble(java.io.Serializable cached, java.lang.Object owner)
          Assemble an instance from the given Serializable object.
 java.lang.Object deepCopy(java.lang.Object value)
          Deep copy the given object.
 java.io.Serializable disassemble(java.lang.Object value)
          Returns a Serializable object of the given instance.
 boolean equals(java.lang.Object objectX, java.lang.Object objectY)
          Returns true if the given 2 instances equals to each other.
 int hashCode(java.lang.Object object)
          Returns the hash code of the given instance.
 boolean isMutable()
          Returns true if the instance of the value type is mutable.
 java.lang.Object nullSafeGet(java.sql.ResultSet resultSet, java.lang.String[] names, java.lang.Object owner)
          Generates and returns an instance from the given JDBC ResultSet.
 void nullSafeSet(java.sql.PreparedStatement statement, java.lang.Object value, int index)
          Writes the property value to the JDBC PreparedStatement.
 java.lang.Object replace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)
          During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
 java.lang.Class returnedClass()
          Returns a java type(class) that is been mapped.
 int[] sqlTypes()
          Returns an array of sql column type codes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

UserPermissionType

public UserPermissionType()
Method Detail

assemble

public java.lang.Object assemble(java.io.Serializable cached,
                                 java.lang.Object owner)
                          throws org.hibernate.HibernateException
Assemble an instance from the given Serializable object.

Specified by:
assemble in interface org.hibernate.usertype.UserType
Parameters:
cached - the Serializable object
owner - not used
Returns:
the assembled instance
Throws:
org.hibernate.HibernateException - - if something goes wrong.

deepCopy

public java.lang.Object deepCopy(java.lang.Object value)
Deep copy the given object.

Specified by:
deepCopy in interface org.hibernate.usertype.UserType
Parameters:
value - the given object.
Returns:
the copied object

disassemble

public java.io.Serializable disassemble(java.lang.Object value)
Returns a Serializable object of the given instance.

Specified by:
disassemble in interface org.hibernate.usertype.UserType
Parameters:
value - the instance to serialize
Returns:
a Serializable object

equals

public boolean equals(java.lang.Object objectX,
                      java.lang.Object objectY)
Returns true if the given 2 instances equals to each other.

Specified by:
equals in interface org.hibernate.usertype.UserType
Parameters:
objectX - the first given object
objectY - the second given object
Returns:
true if the given 2 instances equals to each other

hashCode

public int hashCode(java.lang.Object object)
Returns the hash code of the given instance.

Specified by:
hashCode in interface org.hibernate.usertype.UserType
Parameters:
object - the object.
Returns:
the hash code of the given instance

isMutable

public boolean isMutable()
Returns true if the instance of the value type is mutable. Otherwise, returns false.

Specified by:
isMutable in interface org.hibernate.usertype.UserType
Returns:
true if the instance of the value type is mutable. Otherwise, returns false.

nullSafeGet

public java.lang.Object nullSafeGet(java.sql.ResultSet resultSet,
                                    java.lang.String[] names,
                                    java.lang.Object owner)
                             throws java.sql.SQLException
Generates and returns an instance from the given JDBC ResultSet.

Specified by:
nullSafeGet in interface org.hibernate.usertype.UserType
Parameters:
resultSet - the JDBC ResultSet
names - the column names
owner - not used
Returns:
an generated instance
Throws:
java.sql.SQLException - in case of any erros to access the result set.

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement statement,
                        java.lang.Object value,
                        int index)
                 throws java.sql.SQLException
Writes the property value to the JDBC PreparedStatement.

Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Parameters:
statement - the JDBC PreparedStatement
value - the instance to write
index - the index number of the column
Throws:
java.sql.SQLException - in case of any sql error

replace

public java.lang.Object replace(java.lang.Object original,
                                java.lang.Object target,
                                java.lang.Object owner)
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.

Specified by:
replace in interface org.hibernate.usertype.UserType
Parameters:
original - the value from the detached entity being merged
target - the value in the managed entity
owner - not used
Returns:
a merged object

returnedClass

public java.lang.Class returnedClass()
Returns a java type(class) that is been mapped.

Specified by:
returnedClass in interface org.hibernate.usertype.UserType
Returns:
a java type(class) that is been mapped

sqlTypes

public int[] sqlTypes()
Returns an array of sql column type codes. *

Specified by:
sqlTypes in interface org.hibernate.usertype.UserType
Returns:
an array of sql column type codes