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


Java JsonGenerator.writeStartObject方法代碼示例

本文整理匯總了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();
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:27,代碼來源:WelcomeMessage.java

示例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();
        }
    }
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:26,代碼來源:JsonUtil.java

示例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();  
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:18,代碼來源:SerializerOfCollectionWithPaging.java

示例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();
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:26,代碼來源:ConstantLineSerializer.java

示例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();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:25,代碼來源:AdministratieveHandelingSerializer.java

示例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();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:25,代碼來源:DienstbundelSerializer.java

示例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();
}
 
開發者ID:beduino-project,項目名稱:dcaf-java,代碼行數:17,代碼來源:Face.java

示例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();		
}
 
開發者ID:ajoabraham,項目名稱:hue,代碼行數:23,代碼來源:FieldExpSerDe.java

示例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();
}
 
開發者ID:powsybl,項目名稱:powsybl-core,代碼行數:18,代碼來源:LimitViolationSerializer.java

示例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();
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:9,代碼來源:FactSerializer.java

示例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;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:12,代碼來源:OAuth20ProfileController.java

示例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();
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:xsharing-services-router,代碼行數:8,代碼來源:GeoCoordSerializer.java

示例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();
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:11,代碼來源:PathValueOperation.java

示例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();
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:8,代碼來源:OFActionListSerializer.java

示例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();
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:28,代碼來源:DienstbundelGroepSerializer.java


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