本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeBooleanField方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeBooleanField方法的具体用法?Java JsonGenerator.writeBooleanField怎么用?Java JsonGenerator.writeBooleanField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeBooleanField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializePagination
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private void serializePagination(SerializablePagedCollection pagedCol, JsonGenerator jgen) throws IOException,
JsonProcessingException
{
jgen.writeFieldName("pagination");
jgen.writeStartObject();
jgen.writeNumberField("count", pagedCol.getCollection().size());
jgen.writeBooleanField("hasMoreItems", pagedCol.hasMoreItems());
Integer totalItems = pagedCol.getTotalItems();
if(totalItems != null)
{
jgen.writeNumberField("totalItems", totalItems);
}
if (pagedCol.getPaging() != null)
{
jgen.writeNumberField(RecognizedParamsExtractor.PARAM_PAGING_SKIP, pagedCol.getPaging().getSkipCount());
jgen.writeNumberField(RecognizedParamsExtractor.PARAM_PAGING_MAX, pagedCol.getPaging().getMaxItems());
}
jgen.writeEndObject();
}
示例2: OutputStreamDemo
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
public static void OutputStreamDemo() throws IOException {
String out = "";
JsonFactory f = new JsonFactory();
FileOutputStream fos = new FileOutputStream(new File("user.out.json"));
JsonGenerator g = f.createGenerator(fos);
g.writeStartObject();
g.writeObjectFieldStart("name");
g.writeStringField("first", "BorLion");
g.writeStringField("last", "Zhu");
g.writeEndObject(); // for field 'name'
g.writeStringField("gender", "MALE");
g.writeBooleanField("verified", true);
g.writeBinaryField("userImage", "Rm9vYmFyIQ==".getBytes());
g.writeEndObject();
g.writeRaw('\n');
g.close();
}
示例3: 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();
}
示例4: 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();
}
示例5: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator generator) throws IOException {
generator.writeNumber(getCode());
generator.writeNumber(this.requestId);
generator.writeStartObject();
if (this.matchPolicy != MatchPolicy.EXACT) {
generator.writeStringField("match", this.matchPolicy.getExternalValue());
}
if (this.getRetained) {
generator.writeBooleanField("get_retained", this.getRetained);
}
generator.writeEndObject();
generator.writeString(this.topic);
}
示例6: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(final T component,
final JsonGenerator jgen,
final SerializerProvider serializerProvider) throws IOException {
jgen.writeStartObject();
jgen.writeObjectField("type", component.getClass().getSimpleName());
if (component.getLabel() != null) {
jgen.writeStringField("label", component.getLabel());
}
jgen.writeBooleanField("enabled", component.isEnabled());
if (component.getValue() != null) {
jgen.writeObjectField("value", component.getValue());
}
writeSubclassFields(jgen, component);
jgen.writeEndObject();
}
示例7: 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.writeBooleanField(fieldName, convertToBoolean(object));
} else {
jsonGenerator.writeBoolean(convertToBoolean(object));
}
}
示例8: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(LimitViolationsResult limitViolationsResult, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeBooleanField("computationOk", limitViolationsResult.isComputationOk());
jsonGenerator.writeObjectField("limitViolations", limitViolationsResult.getLimitViolations());
jsonGenerator.writeObjectField("actionsTaken", limitViolationsResult.getActionsTaken());
jsonGenerator.writeEndObject();
}
示例9: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(ClassEntity value, JsonGenerator g, SerializerProvider provider) throws IOException {
g.writeStartObject();
g.writeStringField("id", value.getId());
g.writeStringField("value", value.getValue());
g.writeBooleanField("complex", value.isComplex());
g.writeEndObject();
}
示例10: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator generator) throws IOException {
generator.writeNumber(getCode());
generator.writeNumber(this.requestId);
generator.writeStartObject();
if (this.discloseMe) {
generator.writeBooleanField("disclose_me", this.discloseMe);
}
generator.writeEndObject();
generator.writeString(this.procedure);
if (this.argumentsKw != null) {
if (this.arguments == null) {
generator.writeStartArray();
generator.writeEndArray();
}
else {
generator.writeObject(this.arguments);
}
generator.writeObject(this.argumentsKw);
}
else if (this.arguments != null) {
generator.writeObject(this.arguments);
}
}
示例11: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(FirewallRule rule, JsonGenerator jGen,
SerializerProvider serializer) throws IOException,
JsonProcessingException {
jGen.writeStartObject();
jGen.writeNumberField("ruleid", rule.ruleid);
jGen.writeStringField("dpid", rule.dpid.toString());
jGen.writeNumberField("in_port", rule.in_port.getPortNumber());
jGen.writeStringField("dl_src", rule.dl_src.toString());
jGen.writeStringField("dl_dst", rule.dl_dst.toString());
jGen.writeNumberField("dl_type", rule.dl_type.getValue());
jGen.writeStringField("nw_src_prefix", rule.nw_src_prefix_and_mask.getValue().toString());
jGen.writeNumberField("nw_src_maskbits", rule.nw_src_prefix_and_mask.getMask().asCidrMaskLength());
jGen.writeStringField("nw_dst_prefix", rule.nw_dst_prefix_and_mask.getValue().toString());
jGen.writeNumberField("nw_dst_maskbits", rule.nw_dst_prefix_and_mask.getMask().asCidrMaskLength());
jGen.writeNumberField("nw_proto", rule.nw_proto.getIpProtocolNumber());
jGen.writeNumberField("tp_src", rule.tp_src.getPort());
jGen.writeNumberField("tp_dst", rule.tp_dst.getPort());
jGen.writeBooleanField("any_dpid", rule.any_dpid);
jGen.writeBooleanField("any_in_port", rule.any_in_port);
jGen.writeBooleanField("any_dl_src", rule.any_dl_src);
jGen.writeBooleanField("any_dl_dst", rule.any_dl_dst);
jGen.writeBooleanField("any_dl_type", rule.any_dl_type);
jGen.writeBooleanField("any_nw_src", rule.any_nw_src);
jGen.writeBooleanField("any_nw_dst", rule.any_nw_dst);
jGen.writeBooleanField("any_nw_proto", rule.any_nw_proto);
jGen.writeBooleanField("any_tp_src", rule.any_tp_src);
jGen.writeBooleanField("any_tp_dst", rule.any_tp_dst);
jGen.writeNumberField("priority", rule.priority);
jGen.writeStringField("action", String.valueOf(rule.action));
jGen.writeEndObject();
}
示例12: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator generator) throws IOException {
generator.writeNumber(getCode());
generator.writeNumber(this.requestId);
generator.writeStartObject();
if (this.discloseCaller) {
generator.writeBooleanField("disclose_caller", this.discloseCaller);
}
generator.writeEndObject();
generator.writeString(this.procedure);
}
示例13: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
protected void serialize(T tableDisplay, JsonGenerator jgen) throws IOException {
// String id = updateManagerProvider.get().register(tableDisplay);
// tableObjectManagerProvider.get().registerTableDisplay(id, tableDisplay);
// jgen.writeStringField("update_id", id);
jgen.writeBooleanField("hasDoubleClickAction", tableDisplay.hasDoubleClickAction());
jgen.writeStringField("doubleClickTag", tableDisplay.getDoubleClickTag());
jgen.writeObjectField("contextMenuItems", tableDisplay.getContextMenuItems());
jgen.writeObjectField("contextMenuTags", tableDisplay.getContextMenuTags());
}
示例14: encodeFrame
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
String encodeFrame() throws IOException {
StringWriter w = new StringWriter();
JsonGenerator generator = factory.createGenerator(w);
generator.writeStartObject();
generator.writeFieldName("client_oid");
generator.writeString(getClientOrderId().getId());
generator.writeFieldName("size");
generator.writeString(getQuantity().getValue().toString());
if (price != null && stopPrice == null) {
generator.writeStringField("type", "limit");
generator.writeFieldName("price");
generator.writeString(getPrice().getValue().toString());
generator.writeBooleanField("post_only", true);
} else if (stopPrice != null) {
generator.writeStringField("type", "stop");
generator.writeFieldName("price");
generator.writeString(getStopPrice().getValue().toString());
}
generator.writeFieldName("side");
generator.writeString(getSide().toString().toLowerCase());
generator.writeFieldName("product_id");
generator.writeString(getProduct().getCode());
generator.writeFieldName("time_in_force");
generator.writeString(getTimeInForceCode(getTimeInForce()));
if (getTimeInForce() == TimeInForce.DAY) {
generator.writeFieldName("cancel_after");
generator.writeString("day");
}
generator.writeEndObject();
generator.flush();
return w.toString();
}
示例15: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(PrivateFieldModel object, JsonGenerator jsonGenerator, boolean writeStartAndEnd) throws IOException {
if (writeStartAndEnd) {
jsonGenerator.writeStartObject();
}
if (object.getStringThatStartsWithM() != null) {
jsonGenerator.writeStringField("string_to_test_m_vars", object.getStringThatStartsWithM());
}
jsonGenerator.writeBooleanField("privateBoolean", object.isPrivateBoolean());
final List<String> lslocalprivateList = object.getPrivateList();
if (lslocalprivateList != null) {
jsonGenerator.writeFieldName("privateList");
jsonGenerator.writeStartArray();
for (String element1 : lslocalprivateList) {
if (element1 != null) {
jsonGenerator.writeString(element1);
}
}
jsonGenerator.writeEndArray();
}
final Map<String, String> lslocalprivateMap = object.getPrivateMap();
if (lslocalprivateMap != null) {
jsonGenerator.writeFieldName("privateMap");
jsonGenerator.writeStartObject();
for (Map.Entry<String, String> entry1 : lslocalprivateMap.entrySet()) {
jsonGenerator.writeFieldName(entry1.getKey().toString());
if (entry1.getValue() != null) {
jsonGenerator.writeString(entry1.getValue());
}
}
jsonGenerator.writeEndObject();
}
if (object.getPrivateNamedString() != null) {
jsonGenerator.writeStringField("private_named_string", object.getPrivateNamedString());
}
if (object.getPrivateString() != null) {
jsonGenerator.writeStringField("privateString", object.getPrivateString());
}
if (writeStartAndEnd) {
jsonGenerator.writeEndObject();
}
}