Package com.cedarsoft.test

Examples of com.cedarsoft.test.Money


  public Extra deserialize( XMLStreamReader deserializeFrom, Version formatVersion ) throws IOException, XMLStreamException {
    assert isVersionReadable( formatVersion );
    String description = getChildText( deserializeFrom, "description" );

    nextTag( deserializeFrom, "price" );
    Money price = deserialize( Money.class, formatVersion, deserializeFrom );
    //closes the price tag automatically

    //we have to close our tag now
    closeTag( deserializeFrom );
View Full Code Here


  public Money deserialize( XMLStreamReader deserializeFrom, Version formatVersion ) throws IOException, XMLStreamException {
    assert isVersionReadable( formatVersion );
    int cents = Integer.parseInt( getText( deserializeFrom ) );

    //We don't have to close the tag. The getText method does that for us
    return new Money( cents );
  }
View Full Code Here

    nextTag( deserializeFrom, "model" );
    Model model = deserialize( Model.class, formatVersion, deserializeFrom );

    nextTag( deserializeFrom, "basePrice" );
    Money basePrice = deserialize( Money.class, formatVersion, deserializeFrom );

    //Now we visit all remaining children (should only be extras)
    List<? extends Extra> extras = deserializeCollection( deserializeFrom, Extra.class, formatVersion );

    return new Car( model, color, basePrice, extras );
View Full Code Here

  public Extra deserialize( XMLStreamReader deserializeFrom, Version formatVersion ) throws IOException, XMLStreamException {
    assert isVersionReadable( formatVersion );
    String description = getChildText( deserializeFrom, "description" );

    nextTag( deserializeFrom, "price" );
    Money price = deserialize( Money.class, formatVersion, deserializeFrom );
    //closes the price tag automatically

    //we have to close our tag now
    closeTag( deserializeFrom );
View Full Code Here

      //We have to close the tag! Every stax based serializer has to close its tag
      //getText does this automatically for us. But when only using attributes, we have to close it manually.
      closeTag( deserializeFrom );

      return new Money( cents );

      //The old format that does not use an attribute but text instead
    } else if ( formatVersion.equals( new Version( 1, 0, 0 ) ) ) {
      int cents = Integer.parseInt( getText( deserializeFrom ) );

      //We don't have to close the tag. The getText method does that for us
      return new Money( cents );

      //Whoo - something went terribly wrong
    } else {
      throw new UnsupportedVersionException( formatVersion, getFormatVersionRange() );
    }
View Full Code Here

    nextTag( deserializeFrom, "model" );
    Model model = deserialize( Model.class, formatVersion, deserializeFrom );

    nextTag( deserializeFrom, "basePrice" );
    Money basePrice = deserialize( Money.class, formatVersion, deserializeFrom );

    //Now we visit all remaining children (should only be extras)
    List<? extends Extra> extras = deserializeCollection( deserializeFrom, Extra.class, formatVersion );

    return new Car( model, color, basePrice, extras );
View Full Code Here

  @Override
  public Extra deserialize( XMLStreamReader deserializeFrom, Version formatVersion ) throws IOException, XMLStreamException {
    String description = getChildText( deserializeFrom, "description" );

    nextTag( deserializeFrom, "price" );
    Money price = moneySerializer.deserialize( deserializeFrom, VERSION_MONEY_SERIALIZER );
    //closes the price tag automatically

    //we have to close our tag now
    closeTag( deserializeFrom );
View Full Code Here

  @Override
  public Money deserialize( XMLStreamReader deserializeFrom, Version formatVersion ) throws IOException, XMLStreamException {
    int cents = Integer.parseInt( getText( deserializeFrom ) );

    //We don't have to close the tag. The getText method does that for us
    return new Money( cents );
  }
View Full Code Here

      //We have to close the tag! Every stax based serializer has to close its tag
      //getText does this automatically for us. But when only using attributes, we have to close it manually.
      closeTag( deserializeFrom );

      return new Money( cents );

      //The old format that does not use an attribute but text instead
    } else if ( formatVersion.equals( new Version( 1, 0, 0 ) ) ) {
      int cents = Integer.parseInt( getText( deserializeFrom ) );

      //We don't have to close the tag. The getText method does that for us
      return new Money( cents );

      //Whoo - something went terribly wrong
    } else {
      throw new UnsupportedVersionException( formatVersion, getFormatVersionRange() );
    }
View Full Code Here

    nextTag( deserializeFrom, "model" );
    Model model = modelSerializer.deserialize( deserializeFrom, VERSION_MODEL_SERIALIZER );

    nextTag( deserializeFrom, "basePrice" );
    Money basePrice = moneySerializer.deserialize( deserializeFrom, VERSION_MONEY_SERIALIZER );

    //Now we visit all remaining children (should only be extras)
    final List<Extra> extras = new ArrayList<Extra>();
    visitChildren( deserializeFrom, new CB() {
      @Override
View Full Code Here

TOP

Related Classes of com.cedarsoft.test.Money

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.