Package com.cedarsoft

Examples of com.cedarsoft.Version


/**
*
*/
public class BaseNameSerializer extends AbstractStaxMateSerializer<BaseName> {
  public BaseNameSerializer() {
    super( "baseName", "http://www.cedarsoft.com/file/baseName", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here


/**
*
*/
public class DateTimeSerializer extends AbstractStaxMateSerializer<DateTime> {
  public DateTimeSerializer() {
    super( "dateTime","http://www.joda.org/time/dateTime", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

  @NotNull
  @NonNls
  public static final String SEPARATOR = "x";

  public DimensionSerializer() {
    super( "dimension", "http://java.sun.com/awt/dimension", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

  @NotNull
  @NonNls
  private static final String ELEMENT_NAME = "name";

  public LicenseSerializer() {
    super( "license", "http://www.cedarsoft.com/serialization/license", License.class, new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

/**
*
*/
public class VersionSerializer extends AbstractStaxMateSerializer<Version> {
  public VersionSerializer() {
    super( "version", "http://www.cedarsoft.com/version", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

  @NotNull
  @NonNls
  private static final String ATTRIBUTE_ALGORITHM = "algorithm";

  public HashSerializer() {
    super( "hash", "http://www.cedarsoft.com/crypt/hash", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

  private static final Version VERSION_MONEY_SERIALIZER = new Version( 1, 0, 0 );

  private final MoneySerializer moneySerializer;

  public ExtraSerializer( MoneySerializer moneySerializer ) {
    super( "extra", "http://www.cedarsoft.com/test/extra", new VersionRange( new Version( 1, 5, 0 ), new Version( 1, 5, 0 ) ) );
    //We choose another version number. Maybe this is an old serializer that has been created within another project.

    this.moneySerializer = moneySerializer;

    //We verify the version here. This is necessary, to ensure that the file format for the
View Full Code Here

*
*/
//START SNIPPET: body
public class MoneySerializer extends AbstractStaxMateSerializer<Money> {
  public MoneySerializer() {
    super( "money", "http://www.cedarsoft.com/test/money",new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

* Writing is only supported for the latest file.
*/
public class MoneySerializer2 extends AbstractStaxMateSerializer<Money> {
  public MoneySerializer2() {
    //This serializer supports an old version, too
    super( "money", "http://www.cedarsoft.com/test/money", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 1 ) ) );
  }
View Full Code Here

    //So it seems easier to add just one if/else.
    //If a serializer evolves further a switch to the strategy pattern might be done. A simple map holding the strategies should do it.


    //The common case - current version
    if ( formatVersion.equals( new Version( 1, 0, 1 ) ) ) {
      int cents = Integer.parseInt( deserializeFrom.getAttributeValue( null, "cents" ) );

      //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 );
View Full Code Here

TOP

Related Classes of com.cedarsoft.Version

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.