本文整理匯總了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();
}
}