当前位置: 首页>>代码示例>>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;未经允许,请勿转载。