Methods Summary |
---|
public java.lang.Object | assemble(java.io.Serializable cached, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
return deepCopy(cached);
|
public java.lang.Object | deepCopy(java.lang.Object value)
MonetoryAmount ma = (MonetoryAmount) value;
return new MonetoryAmount( ma.getAmount(), ma.getCurrency() );
|
public java.io.Serializable | disassemble(java.lang.Object value, org.hibernate.engine.SessionImplementor session)
return (Serializable) deepCopy(value);
|
public boolean | equals(java.lang.Object x, java.lang.Object y)
if (x==y) return true;
if (x==null || y==null) return false;
MonetoryAmount mx = (MonetoryAmount) x;
MonetoryAmount my = (MonetoryAmount) y;
return mx.getAmount().equals( my.getAmount() ) &&
mx.getCurrency().equals( my.getCurrency() );
|
public java.lang.String[] | getPropertyNames()
return new String[] { "amount", "currency" };
|
public org.hibernate.type.Type[] | getPropertyTypes()
return new Type[] { Hibernate.BIG_DECIMAL, Hibernate.CURRENCY };
|
public java.lang.Object | getPropertyValue(java.lang.Object component, int property)
MonetoryAmount ma = (MonetoryAmount) component;
return property==0 ? (Object) ma.getAmount() : (Object) ma.getCurrency();
|
public int | hashCode(java.lang.Object x)
return ( (MonetoryAmount) x ).getAmount().hashCode();
|
public boolean | isMutable()
return true;
|
public java.lang.Object | nullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
BigDecimal amt = (BigDecimal) Hibernate.BIG_DECIMAL.nullSafeGet( rs, names[0] );
Currency cur = (Currency) Hibernate.CURRENCY.nullSafeGet( rs, names[1] );
if (amt==null) return null;
return new MonetoryAmount(amt, cur);
|
public void | nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, org.hibernate.engine.SessionImplementor session)
MonetoryAmount ma = (MonetoryAmount) value;
BigDecimal amt = ma == null ? null : ma.getAmount();
Currency cur = ma == null ? null : ma.getCurrency();
Hibernate.BIG_DECIMAL.nullSafeSet(st, amt, index);
Hibernate.CURRENCY.nullSafeSet(st, cur, index+1);
|
public java.lang.Object | replace(java.lang.Object original, java.lang.Object target, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
return deepCopy(original); //TODO: improve
|
public java.lang.Class | returnedClass()
return MonetoryAmount.class;
|
public void | setPropertyValue(java.lang.Object component, int property, java.lang.Object value)
MonetoryAmount ma = (MonetoryAmount) component;
if ( property==0 ) {
ma.setAmount( (BigDecimal) value );
}
else {
ma.setCurrency( (Currency) value );
}
|