Package com.cedarsoft.serialization.jackson

Examples of com.cedarsoft.serialization.jackson.JacksonParserWrapper.verifyCurrentToken()


    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( deserializeFrom );
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    if ( deserializeFrom.getCurrentName().equals( PROPERTY_SUB_TYPE ) ) {
      parserWrapper.nextToken();
      parserWrapper.verifyCurrentToken( JsonToken.VALUE_STRING );
      String subType = deserializeFrom.getText();

      if ( !subType.equals( SUB_TYPE_CC ) ) {
        throw new IllegalStateException( "Invalid sub type: " + subType );
      }
View Full Code Here


      if ( !subType.equals( SUB_TYPE_CC ) ) {
        throw new IllegalStateException( "Invalid sub type: " + subType );
      }
      parserWrapper.nextToken();
      parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
      String currentName = parserWrapper.getCurrentName();

      if ( !PROPERTY_ID.equals( currentName ) ) {
        throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ID + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
      }
View Full Code Here

    }

    //id
    assert deserializeFrom.getCurrentName().equals( PROPERTY_ID );
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.VALUE_STRING );
    String id = deserializeFrom.getText();
    //name
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();
View Full Code Here

    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.VALUE_STRING );
    String id = deserializeFrom.getText();
    //name
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_NAME.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_NAME + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

    }
    parserWrapper.nextToken();
    String name = deserializeFrom.getText();
    //url
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_URL.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_URL + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

  @Nonnull
  @Override
  public Hash deserialize( @Nonnull JsonParser deserializeFrom, @Nonnull Version formatVersion ) throws VersionException, IOException, JsonProcessingException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( deserializeFrom );
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_ALGORITHM.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ALGORITHM + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

    }
    parserWrapper.nextToken();
    Algorithm algorithm = Algorithm.getAlgorithm( deserializeFrom.getText() );

    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_VALUE.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_VALUE + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

  @Override
  public FileType deserialize( @Nonnull JsonParser deserializeFrom, @Nonnull Version formatVersion )
    throws VersionException, IOException, JsonProcessingException {
    JacksonParserWrapper parserWrapper = new JacksonParserWrapper( deserializeFrom );
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName2 = parserWrapper.getCurrentName();

    if ( !PROPERTY_ID.equals( currentName2 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ID + "> but was <" + currentName2 + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_ID + "> but was <" + currentName2 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    String id = parserWrapper.getText();
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName1 = parserWrapper.getCurrentName();

    if ( !PROPERTY_DEPENDENT_TYPE.equals( currentName1 ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_DEPENDENT_TYPE + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_DEPENDENT_TYPE + "> but was <" + currentName1 + ">", parserWrapper.getCurrentLocation() );
    }
    parserWrapper.nextToken();
    boolean dependentType = parserWrapper.getBooleanValue();
    parserWrapper.nextToken();
    parserWrapper.verifyCurrentToken( JsonToken.FIELD_NAME );
    String currentName = parserWrapper.getCurrentName();

    if ( !PROPERTY_CONTENT_TYPE.equals( currentName ) ) {
      throw new JsonParseException( "Invalid field. Expected <" + PROPERTY_CONTENT_TYPE + "> but was <" + currentName + ">", parserWrapper.getCurrentLocation() );
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.