Package com.cedarsoft.version

Examples of com.cedarsoft.version.Version


   */
  @Nonnull
  protected T deserializeInternal( @Nonnull JsonParser parser, @Nullable Version formatVersionOverride ) throws IOException, JsonProcessingException, InvalidTypeException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );

    Version version = prepareDeserialization( parserWrapper, formatVersionOverride );

    T deserialized = deserialize( parser, version );

    if ( isObjectType() ) {
      if ( parserWrapper.getCurrentToken() != JsonToken.END_OBJECT ) {
View Full Code Here


      if ( formatVersionOverride == null ) {
        wrapper.nextFieldValue( PROPERTY_TYPE );
        String readType = wrapper.getText();
        verifyType( readType );
        wrapper.nextFieldValue( PROPERTY_VERSION );
        Version version = Version.parse( wrapper.getText() );
        verifyVersionReadable( version );
        return version;
      } else {
        verifyVersionReadable( formatVersionOverride );
        return formatVersionOverride;
View Full Code Here

    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

  @Override
  public void serialize( @Nonnull JsonGenerator serializeTo, @Nonnull T object, @Nonnull Version formatVersion ) throws IOException, VersionException, JsonProcessingException {
    assert isVersionWritable( formatVersion );

    SerializingStrategy<T, JsonGenerator, JsonParser, JsonProcessingException> strategy = serializingStrategySupport.findStrategy( object );
    Version resolvedVersion = serializingStrategySupport.resolveVersion( strategy, formatVersion );
    serializeTo.writeStringField( PROPERTY_SUB_TYPE, strategy.getId() );

    strategy.serialize( serializeTo, object, resolvedVersion );
  }
View Full Code Here

    if ( type == null ) {
      throw new JsonParseException( "Attribute" + PROPERTY_SUB_TYPE + " not found. Cannot find strategy.", deserializeFrom.getCurrentLocation() );
    }

    SerializingStrategy<? extends T, JsonGenerator, JsonParser, JsonProcessingException> strategy = serializingStrategySupport.findStrategy( type );
    Version resolvedVersion = serializingStrategySupport.resolveVersion( strategy, formatVersion );
    return strategy.deserialize( deserializeFrom, resolvedVersion );
  }
View Full Code Here

   */
  @Nonnull
  protected T deserializeInternal( @Nonnull JsonParser parser, @Nullable Version formatVersionOverride ) throws IOException, JsonProcessingException, InvalidTypeException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( parser );

    Version version = prepareDeserialization( parserWrapper, formatVersionOverride );

    T deserialized = deserialize( parser, version );

    if ( isObjectType() ) {
      if ( parserWrapper.getCurrentToken() != JsonToken.END_OBJECT ) {
View Full Code Here

      if ( formatVersionOverride == null ) {
        wrapper.nextFieldValue( PROPERTY_TYPE );
        String readType = wrapper.getText();
        verifyType( readType );
        wrapper.nextFieldValue( PROPERTY_VERSION );
        Version version = Version.parse( wrapper.getText() );
        verifyVersionReadable( version );
        return version;
      } else {
        verifyVersionReadable( formatVersionOverride );
        return formatVersionOverride;
View Full Code Here

    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

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.