Examples of GsonBuilder


Examples of com.google.gson.GsonBuilder

 
  private static final Logger log = LoggerFactory.getLogger(JsonModelAdapter.class);
 
  @Override
  public JsonElement serialize(Model<?> src, Type typeOfSrc, JsonSerializationContext context) {
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Vector.class, new JsonVectorAdapter());
    Gson gson = builder.create();
    JsonObject obj = new JsonObject();
    obj.add("class", new JsonPrimitive(src.getClass().getName()));
    obj.add("model", new JsonPrimitive(gson.toJson(src)));
    return obj;
  }
View Full Code Here

Examples of com.google.gson.GsonBuilder

  }
 
  @Override
  public Model<?> deserialize(JsonElement json, Type typeOfT,
                              JsonDeserializationContext context) throws JsonParseException {
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Vector.class, new JsonVectorAdapter());
    Gson gson = builder.create();
    JsonObject obj = json.getAsJsonObject();
    String klass = obj.get("class").getAsString();
    String model = obj.get("model").getAsString();
    ClassLoader ccl = Thread.currentThread().getContextClassLoader();
    Class<?> cl = null;
View Full Code Here

Examples of com.massivecraft.mcore.xlib.gson.GsonBuilder

  public static Random random = new Random();
  public static Gson gson = getMCoreGsonBuilder().create();
 
  public static GsonBuilder getMCoreGsonBuilder()
  {
    return new GsonBuilder()
    .setPrettyPrinting()
    .disableHtmlEscaping()
    .excludeFieldsWithModifiers(Modifier.TRANSIENT)
    .registerTypeAdapter(ObjectId.class, ObjectIdAdapter.get())
    .registerTypeAdapter(UUID.class, UUIDAdapter.get())
View Full Code Here

Examples of gherkin.deps.com.google.gson.GsonBuilder

        }
        return output;
    }

    protected Gson gson() {
        return new GsonBuilder().setPrettyPrinting().create();
    }
View Full Code Here

Examples of net.minecraft.util.com.google.gson.GsonBuilder

    private static final ParameterizedType h = new UserCacheEntryType();

    public UserCache(MinecraftServer minecraftserver, File file1) {
        this.f = minecraftserver;
        this.g = file1;
        GsonBuilder gsonbuilder = new GsonBuilder();

        gsonbuilder.registerTypeHierarchyAdapter(UserCacheEntry.class, new BanEntrySerializer(this, (GameProfileLookup) null));
        this.b = gsonbuilder.create();
        this.b();
    }
View Full Code Here

Examples of org.bukkit.craftbukkit.libs.com.google.gson.GsonBuilder

  public JSONSerializer(Plugin inPlugin, Class<? extends EntityData[]> inDataClass)
  {
    super(inPlugin);
    this.m_dataClass = inDataClass;
    this.m_gson = new GsonBuilder().setPrettyPrinting().registerTypeAdapter(ParameterData.class, new ParameterDataSerializer()).registerTypeAdapter(ParameterData.class, new ParameterDataDeserializer()).create();
  }
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.