Package com.cedarsoft

Examples of com.cedarsoft.Version


  @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

  @NonNls
  private static final String ATTRIBUTE_DEFAULT = "default";

  @Inject
  public FileTypeSerializer( @NotNull ExtensionSerializer extensionSerializer ) {
    super( "fileType", "http://www.cedarsoft.com/file/type", new VersionRange( new Version( 1, 0, 0 ), new Version( 1, 0, 0 ) ) );

    add( extensionSerializer ).responsibleFor( Extension.class )
      .map( 1, 0, 0 ).toDelegateVersion( 1, 0, 0 )
      ;
View Full Code Here

  @NotNull
  public Application deserialize( @NotNull XMLStreamReader deserializeFrom, @NotNull Version formatVersion ) throws IOException, XMLStreamException {
    String name = getChildText( deserializeFrom, ELEMENT_NAME );

    nextTag( deserializeFrom, ELEMENT_VERSION );
    Version applicationVersion = deserialize( Version.class, formatVersion, deserializeFrom );
    closeTag( deserializeFrom );

    return new Application( name, applicationVersion );
  }
View Full Code Here

   *
   * @param delegate              the delegate
   * @param expectedFormatVersion the expected format version
   */
  protected static void verifyDelegatingSerializerVersion( @NotNull Serializer<?> delegate, @NotNull Version expectedFormatVersion ) {
    Version actualVersion = delegate.getFormatVersion();
    if ( !actualVersion.equals( expectedFormatVersion ) ) {
      throw new IllegalArgumentException( "Invalid versions. Expected <" + expectedFormatVersion + "> but was <" + actualVersion + ">" );
    }
  }
View Full Code Here

  protected Version parseAndVerifyNameSpace( @Nullable @NonNls String namespaceURI ) throws InvalidNamespaceException, VersionException {
    //Verify the name space
    verifyNamespaceUri( namespaceURI );

    //Parse and verify the version
    Version formatVersion = parseVersionFromNamespaceUri( namespaceURI );
    verifyVersionReadable( formatVersion );
    return formatVersion;
  }
View Full Code Here

   * @param formatVersion the format version
   * @throws IOException
   */
  protected <T> void serializeCollection( @NotNull Iterable<? extends T> objects, @NotNull Class<T> type, @NotNull @NonNls String elementName, @NotNull SMOutputElement serializeTo, @NotNull Version formatVersion ) throws XMLStreamException, IOException {
    AbstractXmlSerializer<? super T, SMOutputElement, XMLStreamReader, XMLStreamException> serializer = getSerializer( type );
    Version resolvedVersion = getDelegatesMappings().resolveVersion( type, formatVersion );

    for ( T object : objects ) {
      SMOutputElement doorElement = serializeTo.addElement( serializeTo.getNamespace(), elementName );
      serializer.serialize( doorElement, object, resolvedVersion );
    }
View Full Code Here

    }
  }

  protected <T> void serializeCollection( @NotNull Iterable<? extends T> objects, @NotNull Class<T> type, @NotNull SMOutputElement serializeTo, @NotNull Version formatVersion ) throws XMLStreamException, IOException {
    AbstractXmlSerializer<? super T, SMOutputElement, XMLStreamReader, XMLStreamException> serializer = getSerializer( type );
    Version resolvedVersion = getDelegatesMappings().resolveVersion( type, formatVersion );

    for ( T object : objects ) {
      SMOutputElement doorElement = serializeTo.addElement( serializeTo.getNamespace(), serializer.getDefaultElementName() );
      serializer.serialize( doorElement, object, resolvedVersion );
    }
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.