@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() ) ); }
@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(); }
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(); } }
public String objectToSQLString(Object value, Dialect dialect) throws Exception { return ( (EnhancedUserType) userType ).objectToSQLString(value); }
public Object fromXMLString(String xml, Mapping factory) { return ( (EnhancedUserType) userType ).fromXMLString(xml); }
public Object stringToObject(String xml) { return ( (EnhancedUserType) userType ).fromXMLString(xml); }