类org.hibernate.usertype.EnhancedUserType源码实例Demo

下面列出了怎么用org.hibernate.usertype.EnhancedUserType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: CustomType.java
@Override
public Object fromStringValue(String string) throws HibernateException {
	if ( StringRepresentableType.class.isInstance( getUserType() ) ) {
		return ( (StringRepresentableType) getUserType() ).fromStringValue( string );
	}
	if ( EnhancedUserType.class.isInstance( getUserType() ) ) {
		//noinspection deprecation
		return ( (EnhancedUserType) getUserType() ).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()
			)
	);
}
 
源代码2 项目: lams   文件: CustomType.java
@Override
@SuppressWarnings("unchecked")
public String toString(Object value) throws HibernateException {
	if ( StringRepresentableType.class.isInstance( getUserType() ) ) {
		return ( (StringRepresentableType) getUserType() ).toString( value );
	}
	if ( value == null ) {
		return null;
	}
	if ( EnhancedUserType.class.isInstance( getUserType() ) ) {
		//noinspection deprecation
		return ( (EnhancedUserType) getUserType() ).toXMLString( value );
	}
	return value.toString();
}
 
源代码3 项目: 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();
	}
}
 
源代码4 项目: lams   文件: CustomType.java
@Override
public String objectToSQLString(Object value, Dialect dialect) throws Exception {
	return ( (EnhancedUserType) getUserType() ).objectToSQLString( value);
}
 
源代码5 项目: cacheonix-core   文件: CustomType.java
public Object fromXMLString(String xml, Mapping factory) {
	return ( (EnhancedUserType) userType ).fromXMLString(xml);
}
 
源代码6 项目: cacheonix-core   文件: CustomType.java
public Object stringToObject(String xml) {
	return ( (EnhancedUserType) userType ).fromXMLString(xml);
}
 
源代码7 项目: cacheonix-core   文件: CustomType.java
public String objectToSQLString(Object value, Dialect dialect) throws Exception {
	return ( (EnhancedUserType) userType ).objectToSQLString(value);
}
 
 类所在包
 同包方法