當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonGenerator.writeNullField方法代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:claudiodegio,項目名稱:dbsync,代碼行數:14,代碼來源:JSonLongConverter.java

示例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());
    }
}
 
開發者ID:claudiodegio,項目名稱:dbsync,代碼行數:13,代碼來源:JSonStringConverter.java

示例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();
    }
}
 
開發者ID:lebronzj,項目名稱:pysonar2,代碼行數:62,代碼來源:JSONDump.java


注:本文中的com.fasterxml.jackson.core.JsonGenerator.writeNullField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。