|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.core.web.format;  | 
  |  17 |     | 
     | 
  |  18 |     | 
   import java.text.NumberFormat;  | 
  |  19 |     | 
     | 
  |  20 |     | 
   import org.kuali.rice.core.util.RiceKeyConstants;  | 
  |  21 |     | 
   import org.kuali.rice.core.util.type.KualiDecimal;  | 
  |  22 |     | 
   import org.kuali.rice.core.util.type.KualiInteger;  | 
  |  23 |     | 
     | 
  |  24 |    0 |    public class KualiIntegerCurrencyFormatter extends CurrencyFormatter { | 
  |  25 |     | 
     | 
  |  26 |     | 
       protected Object convertToObject(String target) { | 
  |  27 |    0 |            KualiDecimal value = (KualiDecimal) (super.convertToObject(target));  | 
  |  28 |    0 |            return new KualiInteger(value.longValue());  | 
  |  29 |     | 
       }  | 
  |  30 |     | 
     | 
  |  31 |     | 
         | 
  |  32 |     | 
     | 
  |  33 |     | 
     | 
  |  34 |     | 
       public Object format(Object obj) { | 
  |  35 |    0 |            if (obj == null)  | 
  |  36 |    0 |                return null;  | 
  |  37 |     | 
     | 
  |  38 |    0 |            NumberFormat formatter = NumberFormat.getNumberInstance();  | 
  |  39 |    0 |            String string = null;  | 
  |  40 |     | 
     | 
  |  41 |     | 
           try { | 
  |  42 |    0 |                KualiInteger number = (KualiInteger) obj;  | 
  |  43 |    0 |                string = formatter.format(number.doubleValue());  | 
  |  44 |     | 
           }  | 
  |  45 |    0 |            catch (IllegalArgumentException e) { | 
  |  46 |    0 |                throw new FormatException("formatting", RiceKeyConstants.ERROR_CURRENCY, obj.toString(), e); | 
  |  47 |     | 
           }  | 
  |  48 |    0 |            catch (ClassCastException e) { | 
  |  49 |    0 |                throw new FormatException("formatting", RiceKeyConstants.ERROR_CURRENCY, obj.toString(), e); | 
  |  50 |    0 |            }  | 
  |  51 |     | 
     | 
  |  52 |    0 |            return showSymbol() ? string : removeSymbol(string);  | 
  |  53 |     | 
       }  | 
  |  54 |     | 
   }  |