CurrencyTypepublic class CurrencyType extends ImmutableType implements LiteralTypecurrency: A type that maps an SQL VARCHAR to a
java.util.Currency |
Fields Summary |
---|
public static final Class | CURRENCY_CLASS | private static final Method | CURRENCY_GET_INSTANCE | private static final Method | CURRENCY_GET_CODE |
Methods Summary |
---|
public java.lang.Object | fromStringValue(java.lang.String xml)
try {
return CURRENCY_GET_INSTANCE.invoke( null, new Object[] {xml} );
}
catch (Exception e) {
throw new HibernateException("Could not resolve currency code: " + xml);
}
| public java.lang.Object | get(java.sql.ResultSet rs, java.lang.String name)
Class clazz;
try {
clazz = Class.forName("java.util.Currency");
}
catch (ClassNotFoundException cnfe) {
clazz = null;
}
if (clazz==null) {
CURRENCY_CLASS = null;
CURRENCY_GET_INSTANCE = null;
CURRENCY_GET_CODE = null;
}
else {
CURRENCY_CLASS = clazz;
try {
CURRENCY_GET_INSTANCE = clazz.getMethod("getInstance", new Class[] { String.class } );
CURRENCY_GET_CODE = clazz.getMethod("getCurrencyCode", new Class[0] );
}
catch (Exception e) {
throw new AssertionFailure("Exception in static initializer of CurrencyType", e);
}
}
String code = (String) Hibernate.STRING.nullSafeGet(rs, name);
try {
return code==null ? null :
CURRENCY_GET_INSTANCE.invoke(null, new Object[] { code } );
}
catch (Exception e) {
throw new HibernateException("Could not resolve currency code: " + code);
}
| public java.lang.String | getName()
return "currency";
| public java.lang.Class | getReturnedClass()
return CURRENCY_CLASS;
| public java.lang.String | objectToSQLString(java.lang.Object value, org.hibernate.dialect.Dialect dialect)
String code;
try {
code = (String) CURRENCY_GET_CODE.invoke(value, null);
}
catch (Exception e) {
throw new HibernateException("Could not get Currency code", e);
}
return ( (LiteralType) Hibernate.STRING ).objectToSQLString(code, dialect);
| public void | set(java.sql.PreparedStatement st, java.lang.Object value, int index)
Object code;
try {
code = CURRENCY_GET_CODE.invoke(value, null);
}
catch (Exception e) {
throw new HibernateException("Could not get Currency code", e);
}
Hibernate.STRING.set(st, code, index);
| public int | sqlType()
return Hibernate.STRING.sqlType();
| public java.lang.String | toString(java.lang.Object value)
try {
return (String) CURRENCY_GET_CODE.invoke(value, null);
}
catch (Exception e) {
throw new HibernateException("Could not get Currency code", e);
}
|
|