Java 类org.hibernate.usertype.EnhancedUserType 实例源码
项目:lams
文件:CustomType.java
@Override
public Object fromStringValue(String string) throws HibernateException {
if ( StringRepresentableType.class.isInstance( userType ) ) {
return ( (StringRepresentableType) userType ).fromStringValue( string );
}
if ( EnhancedUserType.class.isInstance( userType ) ) {
//noinspection deprecation
return ( (EnhancedUserType) userType ).fromXMLString( string );
}
throw new HibernateException(
String.format(
"Could not process #fromStringValue, UserType class [%s] did not implement %s or %s",
name,
StringRepresentableType.class.getName(),
EnhancedUserType.class.getName()
)
);
}
项目:lams
文件:CustomType.java
@Override
@SuppressWarnings("unchecked")
public String toString(Object value) throws HibernateException {
if ( StringRepresentableType.class.isInstance( userType ) ) {
return ( (StringRepresentableType) userType ).toString( value );
}
if ( value == null ) {
return null;
}
if ( EnhancedUserType.class.isInstance( userType ) ) {
//noinspection deprecation
return ( (EnhancedUserType) userType ).toXMLString( value );
}
return value.toString();
}
项目:cacheonix-core
文件:CustomType.java
public String toXMLString(Object value, SessionFactoryImplementor factory) {
if (value==null) return null;
if (userType instanceof EnhancedUserType) {
return ( (EnhancedUserType) userType ).toXMLString(value);
}
else {
return value.toString();
}
}
项目:lams
文件:CustomType.java
public String objectToSQLString(Object value, Dialect dialect) throws Exception {
return ( (EnhancedUserType) userType ).objectToSQLString(value);
}
项目:cacheonix-core
文件:CustomType.java
public Object fromXMLString(String xml, Mapping factory) {
return ( (EnhancedUserType) userType ).fromXMLString(xml);
}
项目:cacheonix-core
文件:CustomType.java
public Object stringToObject(String xml) {
return ( (EnhancedUserType) userType ).fromXMLString(xml);
}
项目:cacheonix-core
文件:CustomType.java
public String objectToSQLString(Object value, Dialect dialect) throws Exception {
return ( (EnhancedUserType) userType ).objectToSQLString(value);
}