本文整理匯總了Java中com.fasterxml.jackson.core.JsonGenerator.writeStartObject方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonGenerator.writeStartObject方法的具體用法?Java JsonGenerator.writeStartObject怎麽用?Java JsonGenerator.writeStartObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeStartObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JsonGenerator generator) throws IOException {
generator.writeNumber(getCode());
generator.writeNumber(this.sessionId);
generator.writeStartObject();
generator.writeObjectFieldStart("roles");
for (WampRole wampRole : this.roles) {
generator.writeObjectFieldStart(wampRole.getRole());
if (wampRole.hasFeatures()) {
generator.writeObjectFieldStart("features");
for (String feature : wampRole.getFeatures()) {
generator.writeBooleanField(feature, true);
}
generator.writeEndObject();
}
generator.writeEndObject();
}
generator.writeEndObject();
if (this.realm != null) {
generator.writeStringField("realm", this.realm);
}
generator.writeEndObject();
}
示例2: writeExtensions
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
public static <T> void writeExtensions(Extendable<T> extendable, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
Objects.requireNonNull(extendable);
Objects.requireNonNull(jsonGenerator);
Objects.requireNonNull(serializerProvider);
boolean headerDone = false;
if (!extendable.getExtensions().isEmpty()) {
for (Extension<T> extension : extendable.getExtensions()) {
ExtensionJson serializer = ExtensionSupplier.findExtensionJson(extension.getName());
if (serializer != null) {
if (!headerDone) {
jsonGenerator.writeFieldName("extensions");
jsonGenerator.writeStartObject();
headerDone = true;
}
jsonGenerator.writeFieldName(extension.getName());
serializer.serialize(extension, jsonGenerator, serializerProvider);
}
}
if (headerDone) {
jsonGenerator.writeEndObject();
}
}
}
示例3: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(SerializablePagedCollection pagedCol, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
if (pagedCol != null)
{
jgen.writeStartObject();
jgen.writeFieldName("list");
jgen.writeStartObject();
serializePagination(pagedCol, jgen);
serializeContext(pagedCol, jgen);
jgen.writeObjectField("entries", pagedCol.getCollection());
serializeIncludedSource(pagedCol, jgen);
jgen.writeEndObject();
jgen.writeEndObject();
}
}
示例4: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(ConstantLine constantLine, JsonGenerator jgen, SerializerProvider sp)
throws IOException, JsonProcessingException {
jgen.writeStartObject();
boolean isNanoPlot = NanoPlot.class.equals(constantLine.getPlotType());
jgen.writeObjectField("type", constantLine.getClass().getSimpleName());
jgen.writeObjectField("x", isNanoPlot ? processLargeNumber(constantLine.getX()) : constantLine.getX());
jgen.writeObjectField("y", constantLine.getY());
jgen.writeObjectField("visible", constantLine.getVisible());
jgen.writeObjectField("yAxis", constantLine.getYAxis());
jgen.writeObjectField("showLabel", constantLine.getShowLabel());
if (constantLine.getWidth() != null) {
jgen.writeObjectField("width", constantLine.getWidth());
}
if (constantLine.getStyle() != null) {
jgen.writeObjectField("style", constantLine.getStyle().toString());
}
if (constantLine.getColor() instanceof Color) {
jgen.writeObjectField("color", constantLine.getColor());
}
jgen.writeEndObject();
}
示例5: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public final void serialize(final AdministratieveHandeling value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
jgen.writeStartObject();
JsonUtils.writeAsInteger(jgen, "id", value.getId());
JsonUtils.writeAsInteger(jgen, Element.ADMINISTRATIEVEHANDELING_SOORTNAAM.getElementNaam(), ObjectUtils.<Integer>getWaarde(value, "soort.id"));
JsonUtils.writeAsInteger(jgen, Element.ADMINISTRATIEVEHANDELING_PARTIJCODE.getElementNaam(), ObjectUtils.<Short>getWaarde(value, "partij.id"));
JsonUtils.writeAsString(
jgen,
Element.ADMINISTRATIEVEHANDELING_PARTIJCODE.getElementNaam() + Element.PARTIJ_CODE.getElementNaam(),
ObjectUtils.getWaarde(value, "partij.code"));
JsonUtils.writeAsString(
jgen,
Element.ADMINISTRATIEVEHANDELING_TIJDSTIPREGISTRATIE.getElementNaam(),
ObjectUtils.getGeformateerdeWaarde(value, "datumTijdRegistratie", sdf));
JsonUtils.writeAsString(
jgen,
Element.ADMINISTRATIEVEHANDELING_LEVERING_TIJDSTIP.getElementNaam(),
ObjectUtils.getGeformateerdeWaarde(value, "datumTijdLevering", sdf));
JsonUtils.writeAsString(
jgen,
Element.ADMINISTRATIEVEHANDELING_TOELICHTINGONTLENING.getElementNaam(),
ObjectUtils.<String>getWaarde(value, "toelichtingOntlening"));
jgen.writeEndObject();
}
示例6: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public final void serialize(final Dienstbundel value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
jgen.writeStartObject();
JsonUtils.writeAsInteger(jgen, DienstbundelModule.ID, value.getId());
JsonUtils.writeAsInteger(jgen, DienstbundelModule.LEVERINGSAUTORISATIE, value.getLeveringsautorisatie().getId());
JsonUtils.writeAsString(jgen, DienstbundelModule.NAAM, value.getNaam());
JsonUtils.writeAsInteger(jgen, DienstbundelModule.DATUM_INGANG, value.getDatumIngang());
JsonUtils.writeAsInteger(jgen, DienstbundelModule.DATUM_EINDE, value.getDatumEinde());
JsonUtils.writeAsString(jgen, DienstbundelModule.NADERE_POPULATIE_BEPERKING, value.getNaderePopulatiebeperking());
JsonUtils.writeAsString(
jgen,
DienstbundelModule.INDICATIE_NADERE_POPULATIE_BEPERKING_GECONVERTEERD,
value.getIndicatieNaderePopulatiebeperkingVolledigGeconverteerd() == null ? Boolean.TRUE : Boolean.FALSE,
DienstbundelModule.WAARDE_JA,
DienstbundelModule.WAARDE_NEE);
JsonUtils.writeAsString(jgen, DienstbundelModule.TOELICHTING, value.getToelichting());
JsonUtils.writeAsString(
jgen,
DienstbundelModule.INDICATIE_GEBLOKKEERD,
value.getIndicatieGeblokkeerd(),
DienstbundelModule.WAARDE_JA,
DienstbundelModule.WAARDE_NEE);
jgen.writeEndObject();
}
示例7: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Face value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeStartObject();
jgen.writeFieldId(1);
jgen.writeObject(value.sai);
jgen.writeFieldId(5);
jgen.writeNumber(value.getTs().getTime()/1000);
jgen.writeFieldId(6);
jgen.writeNumber(value.getLifetime());
jgen.writeFieldId(12);
jgen.writeBinary(value.getNonce());
jgen.writeFieldId(7);
jgen.writeNumber(value.macMethod.encoding);
jgen.writeEndObject();
}
示例8: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(FieldExpression fe, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField("sql", fe.getSql());
gen.writeArrayFieldStart("tables");
fe.getTables().stream().forEach(t -> {
String n = t.getDatasource().getName() + ".";
if(!CommonUtils.isBlank(t.getSchemaName())) n = n + t.getSchemaName() + ".";
n = n + t.getName();
try {
gen.writeString(n);
} catch (IOException e) {
new RuntimeException("Could not write out expression tables for " + fe.getSql() + ". \n" + e.getMessage());
}
});
gen.writeEndArray();
gen.writeEndObject();
}
示例9: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(LimitViolation limitViolation, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("subjectId", limitViolation.getSubjectId());
jsonGenerator.writeStringField("limitType", limitViolation.getLimitType().name());
JsonUtil.writeOptionalStringField(jsonGenerator, "limitName", limitViolation.getLimitName());
JsonUtil.writeOptionalIntegerField(jsonGenerator, "acceptableDuration", limitViolation.getAcceptableDuration());
jsonGenerator.writeNumberField("limit", limitViolation.getLimit());
jsonGenerator.writeNumberField("limitReduction", limitViolation.getLimitReduction());
jsonGenerator.writeNumberField("value", limitViolation.getValue());
JsonUtil.writeOptionalEnumField(jsonGenerator, "side", limitViolation.getSide());
JsonUtil.writeExtensions(limitViolation, jsonGenerator, serializerProvider);
jsonGenerator.writeEndObject();
}
示例10: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Fact value, JsonGenerator g, SerializerProvider provider) throws IOException {
g.writeStartObject();
g.writeObjectField("s", value.getSubject());
g.writeObjectField("p", value.getPredicate());
g.writeObjectField("o", value.getObject());
g.writeEndObject();
}
示例11: verifyAccessToken
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private TicketGrantingTicket verifyAccessToken(final String accessToken, final JsonGenerator jsonGenerator) throws IOException {
final TicketGrantingTicket ticketGrantingTicket = (TicketGrantingTicket) this.ticketRegistry.getTicket(accessToken);
if (ticketGrantingTicket == null || ticketGrantingTicket.isExpired()) {
LOGGER.error("expired accessToken : {}", accessToken);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.INVALID_REQUEST);
jsonGenerator.writeEndObject();
return null;
}
return ticketGrantingTicket;
}
示例12: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(GeoCoord value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeNumberField("longitude", value.getX());
jgen.writeNumberField("latitude", value.getY());
jgen.writeEndObject();
}
示例13: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public final void serialize(final JsonGenerator jgen,
final SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeStringField("op", op);
jgen.writeStringField("path", path.toString());
jgen.writeFieldName("value");
jgen.writeTree(value);
jgen.writeEndObject();
}
示例14: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(List<OFAction> actions, JsonGenerator jGen, SerializerProvider serializer) throws IOException,
JsonProcessingException {
jGen.writeStartObject();
serializeActions(jGen, actions);
jGen.writeEndObject();
}
示例15: serialize
import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public final void serialize(final DienstbundelGroep value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
jgen.writeStartObject();
JsonUtils.writeAsInteger(jgen, DienstbundelGroepModule.ID, value.getId());
JsonUtils.writeAsInteger(jgen, DienstbundelGroepModule.DIENSTBUNDEL, value.getDienstbundel().getId());
JsonUtils.writeAsString(jgen, DienstbundelGroepModule.GROEP, value.getGroep().getNaam());
JsonUtils.writeAsInteger(jgen, DienstbundelGroepModule.GROEP_ID, value.getGroep().getId());
JsonUtils.writeAsString(
jgen,
DienstbundelGroepModule.INDICATIE_FORMELE_HISTORIE,
value.getIndicatieFormeleHistorie(),
LeveringsautorisatieModule.WAARDE_JA,
LeveringsautorisatieModule.WAARDE_NEE);
JsonUtils.writeAsString(
jgen,
DienstbundelGroepModule.INDICATIE_MATERIELE_HISTORIE,
value.getIndicatieMaterieleHistorie(),
LeveringsautorisatieModule.WAARDE_JA,
LeveringsautorisatieModule.WAARDE_NEE);
JsonUtils.writeAsString(
jgen,
DienstbundelGroepModule.INDICATIE_VERANTWOORDING,
value.getIndicatieVerantwoording(),
LeveringsautorisatieModule.WAARDE_JA,
LeveringsautorisatieModule.WAARDE_NEE);
jgen.writeEndObject();
}