View Javadoc

    1   package org.codehaus.xfire.aegis.type.basic;
    2
    3   import org.codehaus.xfire.MessageContext;
    4   import org.codehaus.xfire.aegis.MessageReader;
    5   import org.codehaus.xfire.aegis.MessageWriter;
    6   import org.codehaus.xfire.aegis.type.Type;
    7
    8   /***
    9    * SimpleSerializer
    10   *
    11   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    12   */
    13  public class ShortType
    14      extends Type
    15  {
    16      public Object readObject(MessageReader reader, MessageContext context)
    17      {
    18          if( null == reader.getValue() )
    19          {
    20              return null;
    21          }
    22          else
    23          {
    24              return new Short( reader.getValue() );
    25          }
    26      }
    27
    28      public void writeObject(Object object, MessageWriter writer, MessageContext context)
    29      {
    30          writer.writeValue( ((Short) object).toString() );
    31      }
    32  }