當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonWriter.endObject方法代碼示例

本文整理匯總了Java中com.google.gson.stream.JsonWriter.endObject方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonWriter.endObject方法的具體用法?Java JsonWriter.endObject怎麽用?Java JsonWriter.endObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gson.stream.JsonWriter的用法示例。


在下文中一共展示了JsonWriter.endObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override public void write(JsonWriter out, T value) throws IOException {
  if (value == null) {
    out.nullValue();
    return;
  }

  out.beginObject();
  try {
    for (BoundField boundField : boundFields.values()) {
      if (boundField.writeField(value)) {
        out.name(boundField.name);
        boundField.write(out, value);
      }
    }
  } catch (IllegalAccessException e) {
    throw new AssertionError();
  }
  out.endObject();
}
 
開發者ID:odoo-mobile-intern,項目名稱:odoo-work,代碼行數:20,代碼來源:ReflectiveTypeAdapterFactory.java

示例2: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void write(JsonWriter out, Calendar value) throws IOException {
    if (value == null) {
        out.nullValue();
        return;
    }
    out.beginObject();
    out.name("year");
    out.value((long) value.get(1));
    out.name("month");
    out.value((long) value.get(2));
    out.name(DAY_OF_MONTH);
    out.value((long) value.get(5));
    out.name(HOUR_OF_DAY);
    out.value((long) value.get(11));
    out.name("minute");
    out.value((long) value.get(12));
    out.name(SECOND);
    out.value((long) value.get(13));
    out.endObject();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:21,代碼來源:TypeAdapters.java

示例3: serialize

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void serialize(JsonWriter writer) throws IOException {
    writer.beginObject();

    writer.name("messages");
    writer.beginArray();
    for(MessageEntry entry : messages) {
        writer.beginObject();
        writer.name(entry.toString());
        entry.serialize(writer);
        writer.endObject();
    }
    writer.endArray();

    writer.endObject();
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:17,代碼來源:CustomMessageEntry.java

示例4: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void write(JsonWriter out, Calendar value) throws IOException {
    if (value == null) {
        out.nullValue();
        return;
    }
    out.beginObject();
    out.name(YEAR);
    out.value((long) value.get(1));
    out.name(MONTH);
    out.value((long) value.get(2));
    out.name(DAY_OF_MONTH);
    out.value((long) value.get(5));
    out.name(HOUR_OF_DAY);
    out.value((long) value.get(11));
    out.name(MINUTE);
    out.value((long) value.get(12));
    out.name(SECOND);
    out.value((long) value.get(13));
    out.endObject();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:21,代碼來源:TypeAdapters.java

示例5: export

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public static void export(Generator generator) {
  if (generator == null || generator.database == null) {
    return;
  }

  try (Connection connection = generator.database.getConnection()) {
    File outDirectory = Exporter.getOutputFolder("statistics", null);
    String timeStamp = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
    Path outFilePath = outDirectory.toPath().resolve("statistics-" + timeStamp + ".json");

    JsonWriter writer = new JsonWriter(new FileWriter(outFilePath.toFile()));
    writer.setIndent("  ");
    writer.beginObject(); // top-level

    reportParameters(writer);
    processOutcomes(connection, writer);
    processAccess(connection, writer);
    processCosts(connection, writer);

    writer.endObject(); // top-level
    writer.close();

  } catch (IOException | SQLException e) {
    e.printStackTrace();
    throw new RuntimeException("error exporting statistics");
  }
}
 
開發者ID:synthetichealth,項目名稱:synthea_java,代碼行數:28,代碼來源:ReportExporter.java

示例6: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void writeJson(JsonWriter json) {
	try {
		json.beginObject();
		text.writeJson(json);
		json.name("color").value(color.name().toLowerCase());
		for (final ChatColor style : styles) {
			json.name(stylesToNames.get(style)).value(true);
		}
		if (clickActionName != null && clickActionData != null) {
			json.name("clickEvent")
					.beginObject()
					.name("action").value(clickActionName)
					.name("value").value(clickActionData)
					.endObject();
		}
		if (hoverActionName != null && hoverActionData != null) {
			json.name("hoverEvent")
					.beginObject()
					.name("action").value(hoverActionName)
					.name("value");
			hoverActionData.writeJson(json);
			json.endObject();
		}
		if (insertionData != null) {
			json.name("insertion").value(insertionData);
		}
		if (translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)) {
			json.name("with").beginArray();
			for (JsonRepresentedObject obj : translationReplacements) {
				obj.writeJson(json);
			}
			json.endArray();
		}
		json.endObject();
	} catch (IOException e) {
		Bukkit.getLogger().log(Level.WARNING, "A problem occured during writing of JSON string", e);
	}
}
 
開發者ID:Chazmondo,項目名稱:RankVouchers,代碼行數:39,代碼來源:MessagePart.java

示例7: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void write(final JsonWriter out, final CloudAppConfiguration value) throws IOException {
    out.beginObject();
    out.name(APP_NAME).value(value.getAppName());
    out.name(APP_URL).value(value.getAppURL());
    out.name(BOOTSTRAP_SCRIPT).value(value.getBootstrapScript());
    out.name(CPU_COUNT).value(value.getCpuCount());
    out.name(MEMORY_MB).value(value.getMemoryMB());
    out.name(APP_CACHE_ENABLE).value(value.isAppCacheEnable());
    out.name(EVENT_TRACE_SAMPLING_COUNT).value(value.getEventTraceSamplingCount());
    out.endObject();
}
 
開發者ID:elasticjob,項目名稱:elastic-job-cloud,代碼行數:13,代碼來源:CloudAppConfigurationGsonFactory.java

示例8: serialize

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void serialize(JsonWriter writer) throws IOException {
    writer.beginObject();

    writer.name("enabled");
    writer.value(enabled);

    writer.name("keyword");
    writer.value(keyword);

    writer.name("type");
    writer.value(type.name());

    writer.name("trigger");
    writer.value(trigger.name());

    writer.name("delay");
    writer.value(getDelay());

    writer.name("messages");
    writer.beginArray();
    for(String msg : messages) {
        writer.value(msg);
    }
    writer.endArray();

    writer.endObject();
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:29,代碼來源:SpamEntry.java

示例9: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void write(JsonWriter out, Location location) throws IOException
{
    out.beginObject();
    out.name("x").value(location == null ? 30000001 : location.getX());
    out.name("y").value(location == null ? 30000001 : location.getY());
    out.name("z").value(location == null ? 30000001 : location.getZ());
    out.name("pitch").value(location == null ? 30000001 : location.getPitch());
    out.name("yaw").value(location == null ? 30000001 : location.getYaw());
    out.name("world").value((location == null || location.getWorld() == null) ? "" : location.getWorld().getName());
    out.endObject();
}
 
開發者ID:WoutDev,項目名稱:Mega-Walls,代碼行數:13,代碼來源:LocationAdapter.java

示例10: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void writeJson(JsonWriter writer) throws IOException {
	writer.name(getKey());
	writer.beginObject();
	for (Map.Entry<String, String> jsonPair : _value.entrySet()) {
		writer.name(jsonPair.getKey()).value(jsonPair.getValue());
	}
	writer.endObject();
}
 
開發者ID:Slaymd,項目名稱:CaulCrafting,代碼行數:10,代碼來源:TextualComponent.java

示例11: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void writeJson(JsonWriter writer) throws IOException {
    writer.name(getKey());
    writer.beginObject();
    for (Map.Entry<String, String> jsonPair : _value.entrySet()) {
        writer.name(jsonPair.getKey()).value(jsonPair.getValue());
    }
    writer.endObject();
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:10,代碼來源:TextualComponent.java

示例12: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void writeJson(JsonWriter jsonWriter) throws IOException {
	jsonWriter.beginObject();
	jsonWriter.name("x").value(x);
	jsonWriter.name("y").value(y);
	jsonWriter.name("z").value(z);
	jsonWriter.endObject();
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:8,代碼來源:Vector3f.java

示例13: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void writeJson(JsonWriter json) {
    try {
        json.beginObject();
        text.writeJson(json);
        json.name("color").value(color.name().toLowerCase());
        for (final ChatColor style : styles) {
            json.name(stylesToNames.get(style)).value(true);
        }
        if (clickActionName != null && clickActionData != null) {
            json.name("clickEvent").beginObject().name("action").value(clickActionName).name("value").value(clickActionData).endObject();
        }
        if (hoverActionName != null && hoverActionData != null) {
            json.name("hoverEvent").beginObject().name("action").value(hoverActionName).name("value");
            hoverActionData.writeJson(json);
            json.endObject();
        }
        if (insertionData != null) {
            json.name("insertion").value(insertionData);
        }
        if (translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)) {
            json.name("with").beginArray();
            for (JsonRepresentedObject obj : translationReplacements) {
                obj.writeJson(json);
            }
            json.endArray();
        }
        json.endObject();
    } catch (IOException e) {
        Bukkit.getLogger().log(Level.WARNING, "A problem occured during writing of JSON string", e);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:32,代碼來源:MessagePart.java

示例14: write

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
@Override
public void write(JsonWriter out, IStudent value) throws IOException {
    GsonTest.log("write");
    out.beginObject();
    out.name("name").value("heaven7");
    out.name("id").value("26");
    out.endObject();
}
 
開發者ID:LightSun,項目名稱:data-mediator,代碼行數:9,代碼來源:StudentTypeAdapter.java

示例15: writeJson

import com.google.gson.stream.JsonWriter; //導入方法依賴的package包/類
public void writeJson(JsonWriter json) {
	try {
		json.beginObject();
		text.writeJson(json);
		json.name("color").value(color.name().toLowerCase());
		for (final ChatColor style : styles) {
			json.name(stylesToNames.get(style)).value(true);
		}
		if (clickActionName != null && clickActionData != null) {
			json.name("clickEvent")
			.beginObject()
			.name("action").value(clickActionName)
			.name("value").value(clickActionData)
			.endObject();
		}
		if (hoverActionName != null && hoverActionData != null) {
			json.name("hoverEvent")
			.beginObject()
			.name("action").value(hoverActionName)
			.name("value");
			hoverActionData.writeJson(json);
			json.endObject();
		}
		if(insertionData != null){
			json.name("insertion").value(insertionData);
		}
		if(translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)){
			json.name("with").beginArray();
			for(JsonRepresentedObject obj : translationReplacements){
				obj.writeJson(json);
			}
			json.endArray();
		}
		json.endObject();
	} catch(IOException e){
		Bukkit.getLogger().log(Level.WARNING, "A problem occured during writing of JSON string", e);
	}
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:39,代碼來源:MessagePart.java


注:本文中的com.google.gson.stream.JsonWriter.endObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。