Examples of fromJSON()


Examples of com.google.gson.Gson.fromJson()

    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(vectorType, new JsonVectorAdapter());
    Gson gson = builder.create();
    String json = gson.toJson(test, vectorType);
    Vector test1 = gson.fromJson(json, vectorType);
    try {
      test1.get("Fee");
      fail();
    } catch (IndexException e) {
      fail();
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(vectorType, new JsonVectorAdapter());
    Gson gson = builder.create();
    String json = gson.toJson(test, vectorType);
    Vector test1 = gson.fromJson(json, vectorType);
    try {
      test1.get("Fee");
      fail();
    } catch (IndexException e) {
      fail();
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    try {
      cl = ccl.loadClass(klass);
    } catch (ClassNotFoundException e) {
      log.warn("Error while loading class", e);
    }
    return (Matrix) gson.fromJson(matrix, cl);
  }

}
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    }.getType();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(vectorType, new JsonVectorAdapter());
    builder.registerTypeAdapter(matrixType, new JsonMatrixAdapter());
    Gson gson = builder.create();
    return gson.fromJson(formatString, matrixType);
  }

  public String asFormatString() {
    Type vectorType = new TypeToken<Vector>() {
    }.getType();
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    assertEquals("format", "nm{n=0 m=[1.100, 2.200, 3.300] sd=0.75}", format);
    String json = model.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Model.class, new JsonModelAdapter());
    Gson gson = builder.create();
    NormalModel model2 = gson.fromJson(json, modelType);
    assertEquals("Json", format, model2.asFormatString(null));
  }

  public void testDirichletSampledNormalModel() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    assertEquals("format", "snm{n=0 m=[1.100, 2.200, 3.300] sd=0.75}", format);
    String json = model.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Model.class, new JsonModelAdapter());
    Gson gson = builder.create();
    SampledNormalModel model2 = gson.fromJson(json, modelType);
    assertEquals("Json", format, model2.asFormatString(null));
  }

  public void testDirichletASNormalModel() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of com.google.gson.Gson.fromJson()

    assertEquals("format", "asnm{n=0 m=[1.100, 2.200, 3.300] sd=[1.100, 2.200, 3.300]}", format);
    String json = model.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Model.class, new JsonModelAdapter());
    Gson gson = builder.create();
    AsymmetricSampledNormalModel model2 = gson.fromJson(json, modelType);
    assertEquals("Json", format, model2.asFormatString(null));
  }

  public void testDirichletL1Model() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of com.hazelcast.logging.SystemLogRecord.fromJson()

        List<SystemLogRecord> list = new LinkedList<SystemLogRecord>();
        String node = in.get("node").asString();
        final JsonArray logs = in.get("logs").asArray();
        for (JsonValue log : logs) {
            SystemLogRecord systemLogRecord = new SystemLogRecord();
            systemLogRecord.fromJson(log.asObject());
            systemLogRecord.setNode(node);
            list.add(systemLogRecord);
        }
        return list;
    }
View Full Code Here

Examples of com.hazelcast.management.MapConfigAdapter.fromJson()

        update = getBoolean(json, "update", false);
        if (!update) {
            boolean hasMapConfig = getBoolean(json, "hasMapConfig", false);
            if (hasMapConfig) {
                final MapConfigAdapter adapter = new MapConfigAdapter();
                adapter.fromJson(getObject(json, "mapConfig"));
                return adapter.getMapConfig();
            } else {
                return null;
            }
        }
View Full Code Here

Examples of com.hazelcast.management.SerializableClientEndPoint.fromJson()

            partitions.add(jsonPartition.asInt());
        }
        final JsonArray jsonClients = getArray(json, "clients");
        for (JsonValue jsonClient : jsonClients) {
            final SerializableClientEndPoint client = new SerializableClientEndPoint();
            client.fromJson(jsonClient.asObject());
            clients.add(client);
        }
        beans = new SerializableMXBeans();
        beans.fromJson(getObject(json, "beans"));
    }
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.