当前位置: 首页>>代码示例>>Java>>正文


Java JsonWriter.beginArray方法代码示例

本文整理汇总了Java中com.google.gson.stream.JsonWriter.beginArray方法的典型用法代码示例。如果您正苦于以下问题:Java JsonWriter.beginArray方法的具体用法?Java JsonWriter.beginArray怎么用?Java JsonWriter.beginArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gson.stream.JsonWriter的用法示例。


在下文中一共展示了JsonWriter.beginArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void write(JsonWriter writer, Car3 car) throws IOException {
    writer.beginObject();
 
    writer.name("mark").value(car.getMark());
    writer.name("model").value(car.getModel());
    writer.name("type").value(car.getType());
    writer.name("maker").value(car.getMaker());
 
    double costIncludingVAT = car.getCost() + 0.21 * car.getCost();// Add 21% VAT
    writer.name("cost").value(costIncludingVAT);
 
    writer.name("colors");
    writer.beginArray();
    for (String color : car.getColors()) {
        writer.value(color);
    }
    writer.endArray();
    writer.endObject();
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:21,代码来源:Car3TypeAdapter.java

示例3: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void write(JsonWriter out, GsonProperty property, Object value) throws IOException {
    final Class<?> simpleType = property.getType();
    out.beginArray();
    int length = Array.getLength(value);
    if(length > 0) {
        if (simpleType.isPrimitive() || isBoxedClass(simpleType)) {
            for (int i = 0; i < length; i++) {
                writePrimitiveOrItsBox(out, simpleType, Array.get(value, i));
            }
        } else {
            TypeAdapter adapter = getTypeAdapter(simpleType);
            for (int i = 0; i < length; i++) {
                adapter.write(out, Array.get(value, i));
            }
        }
    }
    out.endArray();
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:20,代码来源:TypeHandler.java

示例4: saveToWriter

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public static void saveToWriter(Collection<? extends Record> records, Writer writer) throws IOException {
    JsonWriter jsonWriter = new JsonWriter(writer);
    jsonWriter.beginArray();
    for (Record record : records) {
        jsonWriter.beginObject();
        jsonWriter.name(ALGORITHM_ID).value(record.getAlgorithmId());
        jsonWriter.name(DATASET_ID).value(record.getDatasetId());
        jsonWriter.name(MEASUREMENT_METHOD).value(record.getMeasurementMethod());
        jsonWriter.name(MEASUREMENT_AUTHOR).value(record.getMeasurementAuthor());
        jsonWriter.name(MEASUREMENT_TIME).value(record.getMeasurementTime().toString());
        jsonWriter.name(CPU_MODEL_NAME).value(record.getCpuModelName());
        jsonWriter.name(JAVA_RUNTIME_VERSION).value(record.getJavaRuntimeVersion());
        jsonWriter.name(MEASUREMENTS).beginArray();
        for (double measurement : record.getMeasurements()) {
            jsonWriter.value(measurement);
        }
        jsonWriter.endArray();
        jsonWriter.name(COMMENT).value(record.getComment());
        jsonWriter.endObject();
    }
    jsonWriter.endArray();
}
 
开发者ID:mbuzdalov,项目名称:non-dominated-sorting,代码行数:23,代码来源:Records.java

示例5: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public void write(JsonWriter out, Collection<E> collection) throws IOException {
    if (collection == null) {
        out.nullValue();
        return;
    }
    out.beginArray();
    for (E element : collection) {
        this.elementTypeAdapter.write(out, element);
    }
    out.endArray();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:CollectionTypeAdapterFactory.java

示例6: serialize

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void serialize(JsonWriter writer) throws IOException {
    writer.beginArray();
    for(Bound bound : bounds) {
        writer.beginArray();
        writer.value(bound.getMin());
        writer.value(bound.getMax());
        writer.endArray();
    }
    writer.endArray();
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:12,代码来源:BoundProperty.java

示例7: 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

示例8: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void write(JsonWriter out, SemanticVersion version) throws IOException {
    out.beginArray();
    out.value(version.major());
    out.value(version.minor());
    if(version.patch() != 0) out.value(version.patch());
    out.endArray();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:SemanticVersionTypeAdapter.java

示例9: writeNonNull

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
protected void writeNonNull(JsonWriter out, Set<T> value) throws IOException {
    out.beginArray();
    for(T t : value) {
        out.value(t.name());
    }
    out.endArray();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:LenientEnumSetTypeAdapter.java

示例10: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public void write(JsonWriter out, Object array) throws IOException {
    if (array == null) {
        out.nullValue();
        return;
    }
    out.beginArray();
    int length = Array.getLength(array);
    for (int i = 0; i < length; i++) {
        this.componentTypeAdapter.write(out, Array.get(array, i));
    }
    out.endArray();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:ArrayTypeAdapter.java

示例11: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void write(JsonWriter out, List<Car3> value) throws IOException {
    out.beginArray();
    for(Car3 car3 : value){
        mAdapter.write(out, car3);
    }
    out.endArray();
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:9,代码来源:ListCar3TypeAdapter.java

示例12: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
@Override
public void write(JsonWriter out, List<String> value) throws IOException {
    out.beginArray();
    for(String str : value){
        out.value(str);
    }
    out.endArray();
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:9,代码来源:StringArrayAdapter.java

示例13: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public void write(JsonWriter out, BitSet src) throws IOException {
  if (src == null) {
    out.nullValue();
    return;
  }

  out.beginArray();
  for (int i = 0; i < src.length(); i++) {
    int value = (src.get(i)) ? 1 : 0;
    out.value(value);
  }
  out.endArray();
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:14,代码来源:TypeAdapters.java

示例14: write

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public void write(JsonWriter out, Collection<E> collection) throws IOException {
  if (collection == null) {
    out.nullValue();
    return;
  }

  out.beginArray();
  for (E element : collection) {
    elementTypeAdapter.write(out, element);
  }
  out.endArray();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:CollectionTypeAdapterFactory.java

示例15: writeJson

import com.google.gson.stream.JsonWriter; //导入方法依赖的package包/类
public void writeJson(JsonWriter jsonWriter) throws IOException {
	jsonWriter.beginObject();
	
	jsonWriter.name("oid").value(oid);
	
	jsonWriter.name("indices");
	jsonWriter.beginArray();
	for (int i : indices) {
		jsonWriter.beginObject();
		jsonWriter.name("i").value(i);
		jsonWriter.endObject();
	}
	jsonWriter.endArray();
	jsonWriter.name("vertices");
	jsonWriter.beginArray();
	for (float v : vertices) {
		jsonWriter.beginObject();
		jsonWriter.name("v").value(v);
		jsonWriter.endObject();
	}
	jsonWriter.endArray();
	jsonWriter.name("normals");
	jsonWriter.beginArray();
	for (float n : normals) {
		jsonWriter.beginObject();
		jsonWriter.name("n").value(n);
		jsonWriter.endObject();
	}
	jsonWriter.endArray();
	
	jsonWriter.name("bound");
	bound.writeJson(jsonWriter);
	
	jsonWriter.name("typeName").value(typeName);
	jsonWriter.name("defaultVisiable").value(defaultVisiable);
	
	if (color != null) {
		jsonWriter.name("color");
		color.writeJson(jsonWriter);
	}
	
	jsonWriter.endObject();
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:44,代码来源:GeometryInfoVo.java


注:本文中的com.google.gson.stream.JsonWriter.beginArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。