View Javadoc

    1   package org.codehaus.xfire.aegis.type.basic;
    2
    3   import java.math.BigDecimal;
    4
    5   import org.codehaus.xfire.MessageContext;
    6   import org.codehaus.xfire.aegis.MessageReader;
    7   import org.codehaus.xfire.aegis.MessageWriter;
    8   import org.codehaus.xfire.aegis.type.Type;
    9
    10  /***
    11   * <code>Type</code> for a <code>BigDecimal</code>
    12   *
    13   * @author <a href="mailto:peter.royal@pobox.com">peter royal</a>
    14   */
    15  public class BigDecimalType extends Type
    16  {
    17      public Object readObject( final MessageReader reader, final MessageContext context )
    18      {
    19          final String value = reader.getValue();
    20
    21          return null == value ? null : new BigDecimal( value );
    22      }
    23
    24      public void writeObject( final Object object, final MessageWriter writer, final MessageContext context )
    25      {
    26          writer.writeValue( object.toString() );
    27      }
    28  }