org.broadleafcommerce.core.util.xml
Class BigDecimalRoundingAdapter

java.lang.Object
  extended by javax.xml.bind.annotation.adapters.XmlAdapter<String,BigDecimal>
      extended by org.broadleafcommerce.core.util.xml.BigDecimalRoundingAdapter

public class BigDecimalRoundingAdapter
extends XmlAdapter<String,BigDecimal>

This class allows us to round Big Decimals to 2 decimal places, generally for marshalling purposes. This is to be used with javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters.


Constructor Summary
BigDecimalRoundingAdapter()
           
 
Method Summary
 String marshal(BigDecimal bigDecimal)
           
 BigDecimal unmarshal(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BigDecimalRoundingAdapter

public BigDecimalRoundingAdapter()
Method Detail

unmarshal

public BigDecimal unmarshal(String s)
                     throws Exception
Specified by:
unmarshal in class XmlAdapter<String,BigDecimal>
Throws:
Exception

marshal

public String marshal(BigDecimal bigDecimal)
               throws Exception
Specified by:
marshal in class XmlAdapter<String,BigDecimal>
Throws:
Exception


Copyright © 2012. All Rights Reserved.