当前位置: 首页>>代码示例>>Java>>正文


Java JsonTreeWriter类代码示例

本文整理汇总了Java中com.google.gson.internal.bind.JsonTreeWriter的典型用法代码示例。如果您正苦于以下问题:Java JsonTreeWriter类的具体用法?Java JsonTreeWriter怎么用?Java JsonTreeWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonTreeWriter类属于com.google.gson.internal.bind包,在下文中一共展示了JsonTreeWriter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
final JsonElement toJsonTree(T value) {
    try {
        JsonTreeWriter jsonWriter = new JsonTreeWriter();
        jsonWriter.setLenient(true);
        write(jsonWriter, value);
        return jsonWriter.get();
    } catch (Throwable e) {
        throw new JsonIOException(e);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:TypeAdapter.java

示例2: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
/**
 * Converts {@code value} to a JSON tree.
 *
 * @param value the Java object to convert. May be null.
 * @return the converted JSON tree. May be {@link JsonNull}.
 * @since 2.2
 */
public final JsonElement toJsonTree(T value) {
  try {
    JsonTreeWriter jsonWriter = new JsonTreeWriter();
    write(jsonWriter, value);
    return jsonWriter.get();
  } catch (IOException e) {
    throw new JsonIOException(e);
  }
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:17,代码来源:TypeAdapter.java

示例3: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
public final JsonElement toJsonTree(T value) {
    try {
        JsonTreeWriter jsonWriter = new JsonTreeWriter();
        write(jsonWriter, value);
        return jsonWriter.get();
    } catch (Throwable e) {
        throw new JsonIOException(e);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:TypeAdapter.java

示例4: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
public final JsonElement toJsonTree(Object obj)
{
    JsonElement jsonelement;
    try
    {
        JsonTreeWriter jsontreewriter = new JsonTreeWriter();
        write(jsontreewriter, obj);
        jsonelement = jsontreewriter.get();
    }
    catch (IOException ioexception)
    {
        throw new JsonIOException(ioexception);
    }
    return jsonelement;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:16,代码来源:TypeAdapter.java

示例5: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
/**
 * Converts {@code value} to a JSON tree.
 *
 * @param value the Java object to convert. May be null.
 * @return the converted JSON tree. May be {@link com.google.gson.JsonNull}.
 * @since 2.2
 */
public final JsonElement toJsonTree(T value) {
  try {
    JsonTreeWriter jsonWriter = new JsonTreeWriter();
    write(jsonWriter, value);
    return jsonWriter.get();
  } catch (IOException e) {
    throw new JsonIOException(e);
  }
}
 
开发者ID:sddyljsx,项目名称:android-http-lib-based-on-volley,代码行数:17,代码来源:TypeAdapter.java

示例6: JsonTreeWriter

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
/**
 * Converts {@code value} to a JSON tree.
 *
 * @param value the Java object to convert. May be null.
 * @return the converted JSON tree. May be {@link JsonNull}.
 */
/*public*/ final JsonElement toJsonTree(T value) {
  try {
    JsonTreeWriter jsonWriter = new JsonTreeWriter();
    jsonWriter.setLenient(true);
    write(jsonWriter, value);
    return jsonWriter.get();
  } catch (IOException e) {
    throw new JsonIOException(e);
  }
}
 
开发者ID:jingshauizh,项目名称:androidsummary,代码行数:17,代码来源:TypeAdapter.java

示例7: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
public JsonElement toJsonTree(Object src, Type typeOfSrc) {
    JsonWriter writer = new JsonTreeWriter();
    toJson(src, typeOfSrc, writer);
    return writer.get();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:Gson.java

示例8: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
public JsonElement toJsonTree(Object obj, Type type)
{
    JsonTreeWriter jsontreewriter = new JsonTreeWriter();
    toJson(obj, type, jsontreewriter);
    return jsontreewriter.get();
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:7,代码来源:Gson.java

示例9: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
/**
 * This method serializes the specified object, including those of generic types, into its
 * equivalent representation as a tree of {@link JsonElement}s. This method must be used if the
 * specified object is a generic type. For non-generic objects, use {@link #toJsonTree(Object)}
 * instead.
 *
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtain
 * this type by using the {@link TypeToken} class. For example,
 * to get the type for {@code Collection<Foo>}, you should use:
 * <pre>
 * Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType();
 * </pre>
 * @return Json representation of {@code src}
 * @since 1.4
 */
public JsonElement toJsonTree(Object src, Type typeOfSrc) {
  JsonTreeWriter writer = new JsonTreeWriter();
  toJson(src, typeOfSrc, writer);
  return writer.get();
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:22,代码来源:Gson.java

示例10: toJsonTree

import com.google.gson.internal.bind.JsonTreeWriter; //导入依赖的package包/类
/**
 * This method serializes the specified object, including those of generic types, into its
 * equivalent representation as a tree of {@link JsonElement}s. This method must be used if the
 * specified object is a generic type. For non-generic objects, use {@link #toJsonTree(Object)}
 * instead.
 *
 * @param src the object for which JSON representation is to be created
 * @param typeOfSrc The specific genericized type of src. You can obtain
 * this type by using the {@link com.google.gson.reflect.TypeToken} class. For example,
 * to get the type for {@code Collection<Foo>}, you should use:
 * <pre>
 * Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType();
 * </pre>
 * @return Json representation of {@code src}
 * @since 1.4
 */
public JsonElement toJsonTree(Object src, Type typeOfSrc) {
  JsonTreeWriter writer = new JsonTreeWriter();
  toJson(src, typeOfSrc, writer);
  return writer.get();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:Gson.java


注:本文中的com.google.gson.internal.bind.JsonTreeWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。