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