|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.type.EnumType
public class EnumType
Value type mapper for enumerations. Generally speaking, the proper configuration is picked up from the annotations associated with the mapped attribute. There are a few configuration parameters understood by this type mapper:
EnumType
is used).
Nested Class Summary | |
---|---|
class |
EnumType.EnumValueMapperSupport
|
Nested classes/interfaces inherited from interface org.hibernate.usertype.DynamicParameterizedType |
---|
DynamicParameterizedType.ParameterType |
Field Summary | |
---|---|
static String |
ENUM
|
static String |
NAMED
|
static String |
TYPE
|
Fields inherited from interface org.hibernate.usertype.DynamicParameterizedType |
---|
ACCESS_TYPE, ENTITY, IS_DYNAMIC, IS_PRIMARY_KEY, PARAMETER_TYPE, PROPERTY, RETURNED_CLASS, XPROPERTY |
Constructor Summary | |
---|---|
EnumType()
|
Method Summary | |
---|---|
Object |
assemble(Serializable cached,
Object owner)
Reconstruct an object from the cacheable representation. |
Object |
deepCopy(Object value)
Return a deep copy of the persistent state, stopping at entities and at collections. |
Serializable |
disassemble(Object value)
Transform the object into its cacheable representation. |
boolean |
equals(Object x,
Object y)
Compare two instances of the class mapped by this type for persistence "equality". |
Object |
fromXMLString(String xmlValue)
Parse a string representation of this value, as it appears in an XML document |
int |
hashCode(Object x)
Get a hashcode for the instance, consistent with persistence "equality" |
boolean |
isMutable()
Are objects of this type mutable? |
boolean |
isOrdinal()
|
Object |
nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
Retrieve an instance of the mapped class from a JDBC resultset. |
void |
nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
Write an instance of the mapped class to a prepared statement. |
String |
objectToSQLString(Object value)
Return an SQL literal representation of the value |
Object |
replace(Object original,
Object target,
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. |
Class<? extends Enum> |
returnedClass()
The class returned by nullSafeGet(). |
void |
setParameterValues(Properties parameters)
Gets called by Hibernate to pass the configured type parameters to the implementation. |
int[] |
sqlTypes()
Return the SQL type codes for the columns mapped by this type. |
String |
toLoggableString(Object value,
SessionFactoryImplementor factory)
Generate a loggable string representation of the collection (value). |
String |
toXMLString(Object value)
Return a string representation of this value, as it should appear in an XML document |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ENUM
public static final String NAMED
public static final String TYPE
Constructor Detail |
---|
public EnumType()
Method Detail |
---|
public int[] sqlTypes()
UserType
sqlTypes
in interface UserType
Types
public Class<? extends Enum> returnedClass()
UserType
returnedClass
in interface UserType
public boolean equals(Object x, Object y) throws HibernateException
UserType
equals
in interface UserType
HibernateException
public int hashCode(Object x) throws HibernateException
UserType
hashCode
in interface UserType
HibernateException
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws SQLException
UserType
nullSafeGet
in interface UserType
rs
- a JDBC result setnames
- the column namesowner
- the containing entity @return Object
SQLException
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException
UserType
nullSafeSet
in interface UserType
st
- a JDBC prepared statementvalue
- the object to writeindex
- statement parameter index
HibernateException
SQLException
public Object deepCopy(Object value) throws HibernateException
UserType
deepCopy
in interface UserType
value
- the object to be cloned, which may be null
HibernateException
public boolean isMutable()
UserType
isMutable
in interface UserType
public Serializable disassemble(Object value) throws HibernateException
UserType
disassemble
in interface UserType
value
- the object to be cached
HibernateException
public Object assemble(Serializable cached, Object owner) throws HibernateException
UserType
assemble
in interface UserType
cached
- the object to be cachedowner
- the owner of the cached object
HibernateException
public Object replace(Object original, Object target, Object owner) throws HibernateException
UserType
replace
in interface UserType
original
- the value from the detached entity being mergedtarget
- the value in the managed entity
HibernateException
public void setParameterValues(Properties parameters)
ParameterizedType
setParameterValues
in interface ParameterizedType
public String objectToSQLString(Object value)
EnhancedUserType
objectToSQLString
in interface EnhancedUserType
public String toXMLString(Object value)
EnhancedUserType
toXMLString
in interface EnhancedUserType
public Object fromXMLString(String xmlValue)
EnhancedUserType
fromXMLString
in interface EnhancedUserType
public String toLoggableString(Object value, SessionFactoryImplementor factory)
LoggableUserType
toLoggableString
in interface LoggableUserType
value
- The collection to be logged; guarenteed to be non-null and initialized.factory
- The factory.
public boolean isOrdinal()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |