Examples of JsonTreeReader


Examples of com.google.gson.internal.bind.JsonTreeReader

  @SuppressWarnings("unchecked")
  public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
    if (json == null) {
      return null;
    }
    return (T) fromJson(new JsonTreeReader(json), typeOfT);
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

  @SuppressWarnings("unchecked")
  public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
    if (json == null) {
      return null;
    }
    return (T) fromJson(new JsonTreeReader(json), typeOfT);
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

   * @param jsonTree the Java object to convert. May be {@link JsonNull}.
   * @since 2.2
   */
  public final T fromJsonTree(JsonElement jsonTree) {
    try {
      JsonReader jsonReader = new JsonTreeReader(jsonTree);
      return read(jsonReader);
    } catch (IOException e) {
      throw new JsonIOException(e);
    }
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

  @SuppressWarnings("unchecked")
  public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
    if (json == null) {
      return null;
    }
    return (T) fromJson(new JsonTreeReader(json), typeOfT);
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

  public Object fromJson(JsonElement paramJsonElement, Type paramType)
    throws JsonSyntaxException
  {
    if (paramJsonElement == null)
      return null;
    return fromJson(new JsonTreeReader(paramJsonElement), paramType);
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

  public final Object fromJsonTree(JsonElement paramJsonElement)
  {
    try
    {
      JsonTreeReader localJsonTreeReader = new JsonTreeReader(paramJsonElement);
      return read(localJsonTreeReader);
    }
    catch (IOException localIOException)
    {
      throw new JsonIOException(localIOException);
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

  @SuppressWarnings("unchecked")
  public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
    if (json == null) {
      return null;
    }
    return (T) fromJson(new JsonTreeReader(json), typeOfT);
  }
View Full Code Here

Examples of com.google.gson.internal.bind.JsonTreeReader

   */
  public <T> FlatPackEntity<T> unpack(Type returnType, JsonElement in, Principal principal)
      throws IOException {
    packScope.enter().withPrincipal(principal);
    try {
      return doUnpack(returnType, new JsonTreeReader(in), principal);
    } finally {
      packScope.exit();
    }
  }
View Full Code Here

Examples of com.google.refine.importers.JsonImporter.JSONTreeReader

    public void EnsureJSONParserHandlesgetLocalNameCorrectly() throws Exception{
        String sampleJson = "{\"field\":\"value\"}";
        String sampleJson2 = "{\"field\":{}}";
        String sampleJson3 = "{\"field\":[{},{}]}";
       
        JSONTreeReader parser = new JSONTreeReader(new StringReader(sampleJson));
        Token token = Token.Ignorable;
        int i = 0;
        try{
            while(token != null){
                token = parser.next();
                if(token == null) {
                    break;
                }
                i++;
                if(i == 3){
                    Assert.assertEquals(Token.Value, token);
                    Assert.assertEquals("field", parser.getFieldName());
                }
            }
        }catch(Exception e){
            //silent
        }
       
       
        parser = new JSONTreeReader(new StringReader(sampleJson2));
        token = Token.Ignorable;
        i = 0;
        try{
            while(token != null){
                token = parser.next();
                if(token == null) {
                    break;
                }
                i++;
                if(i == 3){
                    Assert.assertEquals(Token.StartEntity, token);
                    Assert.assertEquals(parser.getFieldName(), "field");
                }
            }
        }catch(Exception e){
            //silent
        }
       
        parser = new JSONTreeReader(new StringReader(sampleJson3));
        token = Token.Ignorable;
        i = 0;
        try{
            while(token != null){
                token = parser.next();
                if(token == null) {
                    break;
                }
                i++;
                if(i == 3){
                    Assert.assertEquals(token, Token.StartEntity);
                    Assert.assertEquals(parser.getFieldName(), "field");
                }
                if(i == 4){
                    Assert.assertEquals(token, Token.StartEntity);
                    Assert.assertEquals(parser.getFieldName(), JsonImporter.ANONYMOUS);
                }
                if(i == 6){
                    Assert.assertEquals(token, Token.StartEntity);
                    Assert.assertEquals(parser.getFieldName(), JsonImporter.ANONYMOUS);
                }
            }
        }catch(Exception e){
            //silent
        }
View Full Code Here

Examples of com.google.refine.importers.JsonImporter.JSONTreeReader

    @Test
    public void detectRecordElementRegressionJsonTest(){
        loadSampleJson();

        String[] path = XmlImportUtilitiesStub.detectRecordElement(
                new JSONTreeReader(new InputStreamReader(inputStream)));
        Assert.assertNotNull(path);
        Assert.assertEquals(path.length, 2);
        Assert.assertEquals(path[0], JsonImporter.ANONYMOUS);
        Assert.assertEquals(path[1], JsonImporter.ANONYMOUS);
    }
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.