本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeNullField方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeNullField方法的具体用法?Java JsonGenerator.writeNullField怎么用?Java JsonGenerator.writeNullField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeNullField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: columnValueToJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void columnValueToJson(JsonGenerator gen, Value value) throws IOException {
String fieldName;
fieldName = value.getMetadata().getName();
if (value.isNull()) {
gen.writeNullField(fieldName);
} else {
gen.writeNumberField(fieldName, value.getValueLong());
}
}
示例2: columnValueToJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void columnValueToJson(JsonGenerator gen, Value value) throws IOException {
String fieldName;
fieldName = value.getMetadata().getName();
if (value.isNull()) {
gen.writeNullField(fieldName);
} else {
gen.writeStringField(fieldName, value.getValueString());
}
}
示例3: writeSymJson
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
private static void writeSymJson(Binding binding, JsonGenerator json) throws IOException {
if (binding.start < 0) {
return;
}
String name = binding.name;
boolean isExported = !(
Binding.Kind.VARIABLE == binding.kind ||
Binding.Kind.PARAMETER == binding.kind ||
Binding.Kind.SCOPE == binding.kind ||
Binding.Kind.ATTRIBUTE == binding.kind ||
(name.length() == 0 || name.charAt(0) == '_' || name.startsWith("lambda%")));
String path = binding.qname.replace('.', '/').replace("%20", ".");
if (!seenDef.contains(path)) {
seenDef.add(path);
json.writeStartObject();
json.writeStringField("name", name);
json.writeStringField("path", path);
json.writeStringField("file", binding.fileOrUrl);
json.writeNumberField("identStart", binding.start);
json.writeNumberField("identEnd", binding.end);
json.writeNumberField("defStart", binding.bodyStart);
json.writeNumberField("defEnd", binding.bodyEnd);
json.writeBooleanField("exported", isExported);
json.writeStringField("kind", binding.kind.toString());
if (Binding.Kind.FUNCTION == binding.kind ||
Binding.Kind.METHOD == binding.kind ||
Binding.Kind.CONSTRUCTOR == binding.kind)
{
json.writeObjectFieldStart("funcData");
// get args expression
String argExpr = null;
Type t = binding.type;
if (t instanceof UnionType) {
t = ((UnionType) t).firstUseful();
}
if (t != null && t instanceof FunType) {
FunctionDef func = ((FunType) t).func;
if (func != null) {
argExpr = func.getArgumentExpr();
}
}
String typeExpr = binding.type.toString();
json.writeNullField("params");
String signature = argExpr == null ? "" : argExpr + "\n" + typeExpr;
json.writeStringField("signature", signature);
json.writeEndObject();
}
json.writeEndObject();
}
}