本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeArrayFieldStart方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeArrayFieldStart方法的具体用法?Java JsonGenerator.writeArrayFieldStart怎么用?Java JsonGenerator.writeArrayFieldStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeArrayFieldStart方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Property value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeStartObject();
gen.writeStringField("type", value.getPropertyType().getSimpleName());
gen.writeBooleanField("indexed", value.isIndexedProperty());
gen.writeArrayFieldStart("methods");
if(value.canRead()) { gen.writeString("read"); }
if(value.canWrite()) { gen.writeString("write"); }
if(value.canAdd()) { gen.writeString("add"); }
if(value.canRemove()) { gen.writeString("remove"); }
if(value.canCount()) { gen.writeString("count"); }
gen.writeEndArray();
// if(value.canRead()) { gen.writeNumberField("value");
gen.writeEndObject();
}
示例2: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(VirtualNetwork vNet, JsonGenerator jGen,
SerializerProvider serializer) throws IOException,
JsonProcessingException {
jGen.writeStartObject();
jGen.writeStringField("name", vNet.name);
jGen.writeStringField("guid", vNet.guid);
jGen.writeStringField("gateway", vNet.gateway);
jGen.writeArrayFieldStart("portMac");
Iterator<Entry<String, MacAddress>> entries = vNet.portToMac.entrySet().iterator();
while (entries.hasNext()){
jGen.writeStartObject();
Entry<String, MacAddress> entry = entries.next();
jGen.writeStringField("port",entry.getKey().toString());
jGen.writeStringField("mac",entry.getValue().toString());
jGen.writeEndObject();
}
jGen.writeEndArray();
jGen.writeEndObject();
}
示例3: 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();
}
示例4: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(SelectFunction value, JsonGenerator gen, SerializerProvider serializers)
throws IOException, JsonProcessingException {
gen.writeStartObject();
gen.writeArrayFieldStart("Fn::Select");
gen.writeString(value.getIndex());
if (value.isExplicitArray()) {
gen.writeStartArray();
}
for (ValueType valueType : value.getStrings()) {
serializers.defaultSerializeValue(valueType, gen);
}
if (value.isExplicitArray()) {
gen.writeEndArray();
}
gen.writeEndArray();
gen.writeEndObject();
}
示例5: writeAdministratieveHandelingen
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private void writeAdministratieveHandelingen(final List<BlobViewObject> administratieveHandelingen, final JsonGenerator jgen) throws IOException {
if (administratieveHandelingen != null && !administratieveHandelingen.isEmpty()) {
jgen.writeObjectFieldStart(Element.ADMINISTRATIEVEHANDELING.getElementNaam());
jgen.writeStringField(VELD_TYPE, "tabelGroep");
jgen.writeArrayFieldStart("kolomtitels");
jgen.writeString("Technisch ID");
jgen.writeString(Element.ADMINISTRATIEVEHANDELING_SOORTNAAM.getElementNaam());
jgen.writeString(Element.ADMINISTRATIEVEHANDELING_PARTIJCODE.getElementNaam());
jgen.writeString(Element.ADMINISTRATIEVEHANDELING_TIJDSTIPREGISTRATIE.getElementNaam());
jgen.writeString("Mutaties");
jgen.writeString("$css");
jgen.writeEndArray();
jgen.writeArrayFieldStart("data");
for (final BlobViewObject administratieveHandeling : administratieveHandelingen) {
writeAdministratieveHandeling(administratieveHandeling, jgen);
}
jgen.writeEndArray();
jgen.writeEndObject();
}
}
示例6: writeHistorieRecordKop
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private void writeHistorieRecordKop(final JsonGenerator jgen, final BlobViewGroep groep) throws IOException {
jgen.writeArrayFieldStart("kolomtitels");
jgen.writeString(INDEX_OBJECT);
if (isFormeel(groep.getElement())) {
jgen.writeString(TIJDSTIP_REGISTRATIE);
jgen.writeString(TIJDSTIP_VERVAL);
jgen.writeString(NADERE_AANDUIDING_VERVAL);
jgen.writeString(ActieType.INHOUD.getOmschrijving());
jgen.writeString(ActieType.VERVAL.getOmschrijving());
jgen.writeString(CSS);
} else if (isMaterieel(groep.getElement())) {
jgen.writeString(DATUM_INGANG_GELDIGHEID);
jgen.writeString(DATUM_EINDE_GELDIGHEID);
jgen.writeString(TIJDSTIP_REGISTRATIE);
jgen.writeString(TIJDSTIP_VERVAL);
jgen.writeString(NADERE_AANDUIDING_VERVAL);
jgen.writeString(ActieType.INHOUD.getOmschrijving());
jgen.writeString(ActieType.AANPASSING.getOmschrijving());
jgen.writeString(ActieType.VERVAL.getOmschrijving());
jgen.writeString(CSS);
}
jgen.writeString(DETAIL);
jgen.writeEndArray();
}
示例7: buildJSONFromFields
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private String buildJSONFromFields(Collection<SearchHitField> values) {
JsonFactory nodeFactory = new JsonFactory();
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
JsonGenerator generator = nodeFactory.createGenerator(stream, JsonEncoding.UTF8);
generator.writeStartObject();
for (SearchHitField value : values) {
if (value.getValues().size() > 1) {
generator.writeArrayFieldStart(value.getName());
for (Object val : value.getValues()) {
generator.writeObject(val);
}
generator.writeEndArray();
} else {
generator.writeObjectField(value.getName(), value.getValue());
}
}
generator.writeEndObject();
generator.flush();
return new String(stream.toByteArray(), Charset.forName("UTF-8"));
} catch (IOException e) {
return null;
}
}
示例8: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(final EasyForm easyForm,
final JsonGenerator jgen,
final SerializerProvider serializerProvider) throws IOException {
synchronized (easyForm) {
jgen.writeStartObject();
jgen.writeObjectField("update_time", System.currentTimeMillis());
jgen.writeObjectField("type", easyForm.getClass().getSimpleName());
jgen.writeStringField("caption", easyForm.getCaption());
if (easyForm.hasComponents()) {
jgen.writeArrayFieldStart("components");
for (EasyFormComponent component : easyForm.getComponentMap().values()) {
jgen.writeObject(component);
}
if (easyForm.hasSaveValuesButton()) {
jgen.writeObject(easyForm.getSaveValuesButton());
}
if (easyForm.hasLoadValuesButton()) {
jgen.writeObject(easyForm.getLoadValuesButton());
}
jgen.writeEndArray();
}
jgen.writeEndObject();
}
}
示例9: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
/**
* Performs the serialization of a OneComponentTime object
*/
@Override
public void serialize(CumulativeTimeBucket ctb,
JsonGenerator jGen,
SerializerProvider serializer)
throws IOException, JsonProcessingException {
jGen.writeStartObject();
Timestamp ts = new Timestamp(ctb.getStartTimeNs()/1000000);
jGen.writeStringField("start-time", ts.toString());
jGen.writeStringField("current-time",
new Timestamp(System.currentTimeMillis()).toString());
jGen.writeNumberField("total-packets", ctb.getTotalPktCnt());
jGen.writeNumberField("average", ctb.getAverageProcTimeNs());
jGen.writeNumberField("min", ctb.getMinTotalProcTimeNs());
jGen.writeNumberField("max", ctb.getMaxTotalProcTimeNs());
jGen.writeNumberField("std-dev", ctb.getTotalSigmaProcTimeNs());
jGen.writeArrayFieldStart("modules");
for (OneComponentTime oct : ctb.getModules()) {
serializer.defaultSerializeValue(oct, jGen);
}
jGen.writeEndArray();
jGen.writeEndObject();
}
示例10: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(final X509CertificateCredential value,
final JsonGenerator generator, final SerializerProvider serializerProvider)
throws IOException {
generator.writeArrayFieldStart("certificates");
Arrays.stream(value.getCertificates()).forEach(Unchecked.consumer(c -> generator.writeBinary(c.getEncoded())));
generator.writeEndArray();
}
示例11: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(Index index, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
// jsonGenerator.writeStartObject();
jsonGenerator.writeObjectFieldStart("index");
jsonGenerator.writeNumberField("number", index.getIndex());
jsonGenerator.writeArrayFieldStart("numbers");
int[] numbers = index.getNumbers().stream().mapToInt(i -> i).toArray();
jsonGenerator.writeArray(numbers, 0, numbers.length);
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
// jsonGenerator.writeEndObject();
}
示例12: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(FindInMapFunction value, JsonGenerator gen, SerializerProvider serializers)
throws IOException, JsonProcessingException {
gen.writeStartObject();
gen.writeArrayFieldStart("Fn::FindInMap");
serializers.defaultSerializeValue(value.getMapName(), gen);
serializers.defaultSerializeValue(value.getTopLevelKey(), gen);
serializers.defaultSerializeValue(value.getSecondLevelKey(), gen);
gen.writeEndArray();
gen.writeEndObject();
}
示例13: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(T value,
JsonGenerator jgen,
SerializerProvider provider)
throws IOException, JsonProcessingException {
synchronized (value) {
jgen.writeStartObject();
jgen.writeObjectField("type", value.getClass().getSimpleName());
serialize(value, jgen);
jgen.writeArrayFieldStart("labels");
if (value.getLabels() != null) {
for (String label : value.getLabels())
jgen.writeObject(label);
}
jgen.writeEndArray();
jgen.writeArrayFieldStart("items");
if (value.getItems() != null) {
for (Object obj : value.getItems())
if (!getObjectSerializer().writeObject(obj, jgen, true))
jgen.writeObject(obj.toString());
}
jgen.writeEndArray();
jgen.writeObjectField("layout", value.getLayoutManager());
jgen.writeEndObject();
}
}
示例14: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public void serialize(JsonGenerator jgen, BeakerObjectConverter boc) throws JsonGenerationException, IOException {
jgen.writeStartObject();
if (theStyle!=null) jgen.writeStringField("thestyle", theStyle);
if (theClass!=null) jgen.writeStringField("theclass", theClass);
jgen.writeArrayFieldStart("cols");
for (dashColumn r : payload)
r.serialize(jgen, boc);
jgen.writeEndArray();
jgen.writeEndObject();
}
示例15: writeObjecten
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
/**
* Schrijf objecten.
* @param element element
* @param objecten objecten
* @param jgen json generator
* @throws IOException bij fouten
*/
public void writeObjecten(final Element element, final Collection<BlobViewObject> objecten, final JsonGenerator jgen) throws IOException {
if (objecten != null && !objecten.isEmpty()) {
jgen.writeObjectFieldStart(element.getElementNaam());
JsonUtils.writeAsString(jgen, TYPE, GROEP);
jgen.writeArrayFieldStart(element.getElementNaam());
for (final BlobViewObject object : objecten) {
jgen.writeStartObject();
writeObject(object, jgen);
jgen.writeEndObject();
}
jgen.writeEndArray();
jgen.writeEndObject();
}
}