Package com.cedarsoft.version

Examples of com.cedarsoft.version.Version


    serializeArray( elements, type, null, serializeTo, formatVersion );
  }

  protected <T> void serializeArray( @Nonnull Iterable<? extends T> elements, @Nonnull Class<T> type, @Nullable String propertyName, @Nonnull JsonGenerator serializeTo, @Nonnull Version formatVersion ) throws IOException {
    JacksonSerializer<? super T> serializer = getSerializer( type );
    Version delegateVersion = delegatesMappings.getVersionMappings().resolveVersion( type, formatVersion );

    if ( propertyName == null ) {
      serializeTo.writeStartArray();
    } else {
      serializeTo.writeArrayFieldStart( propertyName );
View Full Code Here


      serializeTo.writeNull();
      return;
    }

    JacksonSerializer<? super T> serializer = getSerializer( type );
    Version delegateVersion = delegatesMappings.getVersionMappings().resolveVersion( type, formatVersion );
    if ( serializer.isObjectType() ) {
      serializeTo.writeStartObject();
    }

    serializer.serialize( serializeTo, object, delegateVersion );
View Full Code Here

  public Version parseAndVerifyNameSpace( @Nullable String namespaceURI ) throws InvalidNamespaceException, VersionException {
    //Verify the name space
    verifyNamespace( namespaceURI );

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

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

  @Override
  public VersionRange deserialize( @Nonnull JsonParser deserializeFrom, @Nonnull Version formatVersion )
    throws VersionException, IOException, JsonProcessingException {
    //min
    nextFieldValue( deserializeFrom, PROPERTY_MIN );
    Version min = Version.parse( deserializeFrom.getText() );
    //max
    nextFieldValue( deserializeFrom, PROPERTY_MAX );
    Version max = Version.parse( deserializeFrom.getText() );
    //includeLower
    nextFieldValue( deserializeFrom, PROPERTY_INCLUDELOWER );
    boolean includeLower = deserializeFrom.getBooleanValue();
    //includeUpper
    nextFieldValue( deserializeFrom, PROPERTY_INCLUDEUPPER );
View Full Code Here

/**
*
*/
public class DateTimeSerializer extends AbstractJacksonSerializer<DateTime> {
  public DateTimeSerializer() {
    super( "dateTime", new VersionRange( new Version( 0, 9, 0 ), new Version( 1, 0, 0 ) ) );
  }
View Full Code Here

  public Application deserialize( @Nonnull JsonParser deserializeFrom, @Nonnull Version formatVersion ) throws VersionException, IOException, JsonProcessingException {
    //name
    nextFieldValue( deserializeFrom, PROPERTY_NAME );
    String name = deserializeFrom.getText();
    //version
    Version version = deserialize( Version.class, PROPERTY_VERSION, formatVersion, deserializeFrom );
    //Finally closing element
    closeObject( deserializeFrom );
    //Constructing the deserialized object
    return new Application( name, version );
  }
View Full Code Here

  @Nonnull

  private static final String ATTRIBUTE_DELIMITER = "delimiter";

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

/**
*
*/
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

  }

  @Nonnull
  @Override
  public Version getFormatVersion() {
    return new Version( 1, 0, 0 );
  }
View Full Code Here

TOP

Related Classes of com.cedarsoft.version.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.