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


Java JsonGenerator.writeString方法代碼示例

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


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

示例1: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(
        DateTime value,
        JsonGenerator jgen,
        SerializerProvider provider) throws IOException {

    jgen.writeString(DateUtils.formatISO8601Date(value));
}
 
開發者ID:IBM,項目名稱:ibm-cos-sdk-java,代碼行數:9,代碼來源:DateTimeJsonSerializer.java

示例2: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JsonGenerator generator) throws IOException {
	generator.writeNumber(getCode());
	generator.writeString(this.realm);
	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();
	generator.writeEndObject();
}
 
開發者ID:ralscha,項目名稱:wamp2spring,代碼行數:21,代碼來源:HelloMessage.java

示例3: writeSubclassFields

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
protected void writeSubclassFields(final JsonGenerator jgen,
                                   final ComboBox component) throws IOException {
  if (component.getEditable() != null) {
    jgen.writeObjectField("editable", component.getEditable().toString());
  }
  if (component.getWidth() != null) {
    jgen.writeObjectField("width", component.getWidth().toString());
  }
  if (component.getValues() != null && component.getValues().size() > 0) {
    jgen.writeArrayFieldStart("values");
    for (String value : component.getValues()) {
      jgen.writeString(value);
    }
    jgen.writeEndArray();
  }
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:18,代碼來源:ComboBoxSerializer.java

示例4: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(BeakerCodeCell value,
    JsonGenerator jgen,
    SerializerProvider provider)
    throws IOException, JsonProcessingException {

  synchronized (value) {
    jgen.writeStartObject();
    jgen.writeStringField("type", "BeakerCodeCell");
    jgen.writeStringField("execution_count", value.executionCount);
    jgen.writeStringField("cell_type", value.cellType);
    jgen.writeFieldName("outputs");
    if (!getObjectSerializer().writeObject(value.outputs, jgen, true))
      jgen.writeString(value.outputs.toString());
    jgen.writeFieldName("metadata");
    if (!getObjectSerializer().writeObject(value.metadata, jgen, true))
      jgen.writeString(value.metadata.toString());
    jgen.writeStringField("source", value.source);
    jgen.writeEndObject();
  }
}
 
開發者ID:twosigma,項目名稱:beaker-notebook-archive,代碼行數:22,代碼來源:BeakerCodeCell.java

示例5: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(JoinFunction value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    gen.writeStartObject();
    gen.writeArrayFieldStart("Fn::Join");
    gen.writeString(value.getSeparator());

    if (value.isExplicitArray()) {
        gen.writeStartArray();
    }

    for (ValueType valueType : value.getStrings()) {
        serializers.defaultSerializeValue(valueType, gen);
    }

    if (value.isExplicitArray()) {
        gen.writeEndArray();
    }
    gen.writeEndArray();
    gen.writeEndObject();
}
 
開發者ID:salesforce,項目名稱:cf2pojo,代碼行數:22,代碼來源:JoinFunction.java

示例6: toJSONString

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
private void toJSONString(String name, ArrowTypeID typeID, List<Field> children, JsonGenerator jsonGenerator) throws IOException {
  jsonGenerator.writeStartObject();
  jsonGenerator.writeFieldName("name");
  jsonGenerator.writeString(name);

  if (typeID != null) {
    jsonGenerator.writeFieldName("type");
    jsonGenerator.writeString(typeID.name());
  }

  if (children != null && children.size() > 0) {
    jsonGenerator.writeFieldName("children");
    jsonGenerator.writeStartArray(children.size());
    for(Field child : children) {
      toJSONString(child.getName(), child.getType().getTypeID(), child.getChildren(), jsonGenerator);
    }
    jsonGenerator.writeEndArray();
  }
  jsonGenerator.writeEndObject();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:21,代碼來源:BatchSchema.java

示例7: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(SubFunction value, JsonGenerator gen, SerializerProvider serializers)
    throws IOException, JsonProcessingException {
    gen.writeStartObject();
    gen.writeFieldName("Fn::Sub");

    if (value.getVariableMap() == null) {
        gen.writeString(value.getStringTemplate());
    } else {
        gen.writeStartArray();
        gen.writeString(value.getStringTemplate());
        serializers.defaultSerializeValue(value.getVariableMap(), gen);
        gen.writeEndArray();
    }

    gen.writeEndObject();
}
 
開發者ID:salesforce,項目名稱:cf2pojo,代碼行數:18,代碼來源:SubFunction.java

示例8: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(final DividendQualification value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException {
    if (value == null || value == DividendQualification.UNKNOWN) {
        gen.writeNull();
        return;
    }

    switch (value) {
        case PARTIALLY_QUALIFIED_INCOME:
            gen.writeString("P");
            break;
        case QUALIFIED_INCOME:
            gen.writeString("Q");
            break;
        case UNQUALIFIED_INCOME:
            gen.writeString("N");
            break;
        default:
            gen.writeNull();
            break;
    }
}
 
開發者ID:WojciechZankowski,項目名稱:iextrading4j,代碼行數:23,代碼來源:DividendQualificationSerializer.java

示例9: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Date date,
                      JsonGenerator jsonGenerator,
                      SerializerProvider serializerProvider) throws
                                                             IOException {
    jsonGenerator.writeString(DateUtil.formatIso8601Date(date.toInstant()));
}
 
開發者ID:networknt,項目名稱:light-workflow-4j,代碼行數:8,代碼來源:DateModule.java

示例10: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(AccessRequest value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException {

    jgen.writeFieldId(0);
    jgen.writeString(value.samUrl);
    jgen.writeFieldId(1);
    jgen.writeObject(value.sai);
    jgen.writeFieldId(5);
    jgen.writeNumber(value.timestamp.getTime()/1000);
}
 
開發者ID:beduino-project,項目名稱:dcaf-java,代碼行數:12,代碼來源:AccessRequest.java

示例11: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Authorization value, JsonGenerator jgen, SerializerProvider provider)
		throws IOException {

	jgen.writeStartArray();
	jgen.writeString(value.uri);
	jgen.writeNumber(value.methods);
	jgen.writeEndArray();
}
 
開發者ID:beduino-project,項目名稱:dcaf-java,代碼行數:10,代碼來源:Authorization.java

示例12: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(T object, String fieldName, boolean writeFieldNameForObject, JsonGenerator jsonGenerator) throws IOException {
    if (fieldName != null) {
        jsonGenerator.writeStringField(fieldName, convertToString(object));
    } else {
        jsonGenerator.writeString(convertToString(object));
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:StringBasedTypeConverter.java

示例13: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(OvsdbSet set, JsonGenerator generator,
                      SerializerProvider provider)
        throws IOException, JsonProcessingException {
    generator.writeStartArray();
    generator.writeString("set");
    generator.writeStartArray();
    Set javaSet = set.set();
    for (Object key : javaSet) {
        generator.writeObject(key);
    }
    generator.writeEndArray();
    generator.writeEndArray();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:15,代碼來源:OvsdbSetSerializer.java

示例14: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(Geometry geom, JsonGenerator generator,
		SerializerProvider serializerProvider) throws IOException,
		JsonProcessingException {
	generator.writeString(geom.toText());
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:7,代碼來源:JacksonGeometrySerializer.java

示例15: serialize

import com.fasterxml.jackson.core.JsonGenerator; //導入方法依賴的package包/類
@Override
public void serialize(DateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
    gen.writeString(ISODateTimeFormat.dateTime().print(value));
}
 
開發者ID:CSCfi,項目名稱:exam,代碼行數:5,代碼來源:DateTimeAdapter.java


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