本文整理汇总了Java中com.fasterxml.jackson.databind.node.ObjectNode.putNull方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectNode.putNull方法的具体用法?Java ObjectNode.putNull怎么用?Java ObjectNode.putNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.node.ObjectNode
的用法示例。
在下文中一共展示了ObjectNode.putNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addField
import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static void addField(String dbName, String fieldName) throws Exception{
ObjectMapper mapper = new ObjectMapper();
// ObjectNode mainNode = mapper.createObjectNode();
ObjectNode childNode = mapper.createObjectNode();
ArrayNode arrNode = mapper.createArrayNode();
ObjectNode childNodeObject = mapper.createObjectNode();
childNodeObject.put( "field-name", fieldName);
childNodeObject.put( "include-root", true);
childNodeObject.putNull( "included-elements");
childNodeObject.putNull( "excluded-elements");
childNodeObject.putNull( "tokenizer-overrides");
arrNode.add(childNodeObject);
childNode.putArray("field").addAll(arrNode);
// mainNode.put("fields", childNode);
// System.out.println("Entered field to make it true");
setDatabaseProperties(dbName,"field",childNode);
}
示例2: addFieldExcludeRoot
import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
public static void addFieldExcludeRoot(String dbName, String fieldName) throws Exception{
ObjectMapper mapper = new ObjectMapper();
// ObjectNode mainNode = mapper.createObjectNode();
ObjectNode childNode = mapper.createObjectNode();
ArrayNode arrNode = mapper.createArrayNode();
ObjectNode childNodeObject = mapper.createObjectNode();
childNodeObject.put( "field-name", fieldName);
childNodeObject.put( "include-root", false);
childNodeObject.putNull( "included-elements");
childNodeObject.putNull( "excluded-elements");
childNodeObject.putNull( "tokenizer-overrides");
arrNode.add(childNodeObject);
childNode.putArray("field").addAll(arrNode);
// mainNode.put("fields", childNode);
// System.out.println( childNode.toString());
setDatabaseProperties(dbName,"field",childNode);
}
示例3: datumWithNullValue
import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test(expected = JasvornoConverterException.class)
public void datumWithNullValue() throws JsonProcessingException, IOException {
Schema schema = SchemaBuilder.builder().record("record").fields().requiredString("name").endRecord();
ObjectMapper mapper = new ObjectMapper();
ObjectNode dataTable = mapper.createObjectNode();
JsonNode datum = dataTable.putNull("name");
JasvornoConverter.convertToAvro(model, datum, schema, UndeclaredFieldBehaviour.IGNORE);
}
示例4: matchMapValueofNullDatum
import com.fasterxml.jackson.databind.node.ObjectNode; //导入方法依赖的package包/类
@Test
public void matchMapValueofNullDatum() throws JsonProcessingException, IOException {
Schema schema = SchemaBuilder.builder().map().values().nullType();
ObjectMapper mapper = new ObjectMapper();
ObjectNode dataTable = mapper.createObjectNode();
JsonNode datum = dataTable.putNull("field1");
MatchType matchType = new JasvornoConverter(model, UndeclaredFieldBehaviour.NO_MATCH).matchMapValue(datum, schema);
assertThat(matchType, is(MatchType.FULL));
}