Codota Logo
ObjectNode.remove
Code IndexAdd Codota to your IDE (free)

How to use
remove
method
in
org.codehaus.jackson.node.ObjectNode

Best Java code snippets using org.codehaus.jackson.node.ObjectNode.remove (Showing top 20 results out of 315)

  • Common ways to obtain ObjectNode
private void myMethod () {
ObjectNode o =
  • Codota IconJsonNodeFactory instance;instance.objectNode()
  • Codota IconObjectMapper mapper;mapper.createObjectNode()
  • Codota IconArrayNode arrayNode;arrayNode.addObject()
  • Smart code suggestions by Codota
}
origin: kaaproject/kaa

private Schema parseDependencies(CTLSchemaDto schema, final Schema.Parser parser) throws
    Exception {
 if (schema.getDependencySet() != null) {
  for (CTLSchemaDto dependency : schema.getDependencySet()) {
   this.parseDependencies(dependency, parser);
  }
 }
 ObjectNode object = new ObjectMapper().readValue(schema.getBody(), ObjectNode.class);
 object.remove(DEPENDENCIES);
 String body = new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(object);
 return parser.parse(body);
}
origin: kaaproject/kaa

 /**
  * Removes UUIDs from a json tree.
  *
  * @param json json tree node
  */
 public static void removeUuids(JsonNode json) {
  boolean containerWithId = json.isContainerNode() && json.has(UUID_FIELD);
  boolean isArray = json.isArray();
  boolean childIsNotArray = !(json.size() == 1 && json.getElements().next().isArray());

  if (containerWithId && !isArray && childIsNotArray) {
   ((ObjectNode) json).remove(UUID_FIELD);
  }

  for (JsonNode node : json) {
   if (node.isContainerNode()) {
    removeUuids(node);
   }
  }
 }
}
origin: com.github.foodev/jsondiff

@Override
public void remove(String key) {
  wrapped.remove(key);
}

origin: algesten/jsondiff

@Override
public void remove(String key) {
  wrapped.remove(key);
}

origin: eBay/YiDB

private void createJsonNode(MetaClass metadata) {
  currentNode = mapper.valueToTree(metadata);
  currentNode.remove("fields");
  currentNode.remove("options");
  currentNode.put("fields", JsonNodeFactory.instance.objectNode());
}
origin: eBay/YiDB

private void removeFieldProperty(String fieldName, String propertyName) {
  FieldProperty fp = FieldProperty.fromQueryName(propertyName);
  CheckConditions.checkArgument(fp != null, MessageFormat.format("field property %s not found!", propertyName));
  String propertyValueDbName = fieldName + PROPERTY_CONNECTOR + propertyName;
  getNode().remove(propertyValueDbName);
}
origin: eBay/YiDB

@Override
public void removeField(String fieldName) {
  getNode().remove(fieldName);
  for (FieldProperty fp : FieldProperty.values()) {
    removeFieldProperty(fieldName, fp.getName());
  }
}
origin: de.mhus.lib/mhu-lib-core

@Override
public void removeProperty(String name) {
  JsonNode child = node.get(name);
  if (child!=null && !child.isArray() && !child.isObject())
    getNode().remove(name);
}
origin: sirensolutions/siren

private void convertTetheredCable(final JsonNode obj) {
 final Iterator<JsonNode> nodes = obj.path("Connector").iterator();
 while (nodes.hasNext()) {
  final ObjectNode node = (ObjectNode) nodes.next();
  final JsonNode current = node.path("TetheredCable");
  if (!current.isMissingNode() && !current.isNull()) {
   final int value = Integer.parseInt(current.asText());
   node.put("TetheredCable", value);
  }
  if (current.isNull()) {
   node.remove("TetheredCable");
  }
 }
}
origin: rdelbru/SIREn

private void convertLongitude(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation");
 final JsonNode current = node.path("Longitude");
 if (!current.isMissingNode() && !current.isNull()) {
  final double value = Double.parseDouble(current.asText());
  node.put("Longitude", value);
 }
 if (current.isNull()) {
  node.remove("Longitude");
 }
}
origin: sirensolutions/siren

private void convertLongitude(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation");
 final JsonNode current = node.path("Longitude");
 if (!current.isMissingNode() && !current.isNull()) {
  final double value = Double.parseDouble(current.asText());
  node.put("Longitude", value);
 }
 if (current.isNull()) {
  node.remove("Longitude");
 }
}
origin: sirensolutions/siren

private void convertLatitude(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation");
 final JsonNode current = node.path("Latitude");
 if (!current.isMissingNode() && !current.isNull()) {
  final double value = Double.parseDouble(current.asText());
  node.put("Latitude", value);
 }
 if (current.isNull()) {
  node.remove("Latitude");
 }
}
origin: rdelbru/SIREn

private void convertLatitude(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("ChargeDeviceLocation");
 final JsonNode current = node.path("Latitude");
 if (!current.isMissingNode() && !current.isNull()) {
  final double value = Double.parseDouble(current.asText());
  node.put("Latitude", value);
 }
 if (current.isNull()) {
  node.remove("Latitude");
 }
}
origin: apache/samza

/**
 * Given a {@link ContainerModel} JSON with neither a processor-id nor a container-id, deserialization should fail.
 */
@Test(expected = SamzaException.class)
public void testDeserializeContainerModelMissingProcessorIdAndContainerId() throws IOException {
 ObjectNode jobModelJson = buildJobModelJson();
 ObjectNode containerModelJson = (ObjectNode) jobModelJson.get("containers").get("1");
 containerModelJson.remove("processor-id");
 deserializeFromObjectNode(jobModelJson);
}
origin: rdelbru/SIREn

private void convertDeviceControllerWebsite(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("DeviceController");
 final JsonNode current = node.path("Website");
 if (!current.isMissingNode() && !current.isNull()) {
  node.put("Website", this.createValueDatatype("uri", current.asText()));
 }
 if (current.isNull()) {
  node.remove("Website");
 }
}
origin: rdelbru/SIREn

private void convertDeviceOwnerWebsite(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("DeviceOwner");
 final JsonNode current = node.path("Website");
 if (!current.isMissingNode() && !current.isNull()) {
  node.put("Website", this.createValueDatatype("uri", current.asText()));
 }
 if (current.isNull()) {
  node.remove("Website");
 }
}
origin: sirensolutions/siren

private void convertDeviceOwnerWebsite(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("DeviceOwner");
 final JsonNode current = node.path("Website");
 if (!current.isMissingNode() && !current.isNull()) {
  node.put("Website", this.createValueDatatype("uri", current.asText()));
 }
 if (current.isNull()) {
  node.remove("Website");
 }
}
origin: sirensolutions/siren

private void convertDeviceControllerWebsite(final JsonNode obj) {
 final ObjectNode node = (ObjectNode) obj.path("DeviceController");
 final JsonNode current = node.path("Website");
 if (!current.isMissingNode() && !current.isNull()) {
  node.put("Website", this.createValueDatatype("uri", current.asText()));
 }
 if (current.isNull()) {
  node.remove("Website");
 }
}
origin: apache/samza

/**
 * Given a {@link ContainerModel} JSON with only an "id" field, deserialization should fail.
 * This verifies that even though {@link ContainerModel} has a getId method, the "id" field is not used, since
 * "processor-id" is the field that is supposed to be used.
 */
@Test(expected = SamzaException.class)
public void testDeserializeContainerModelIdFieldOnly() throws IOException {
 ObjectNode jobModelJson = buildJobModelJson();
 ObjectNode containerModelJson = (ObjectNode) jobModelJson.get("containers").get("1");
 containerModelJson.remove("processor-id");
 containerModelJson.put("id", 1);
 deserializeFromObjectNode(jobModelJson);
}
origin: apache/samza

/**
 * Given a {@link ContainerModel} JSON without a processor-id but with a container-id, deserialization should use the
 * container-id to calculate the processor-id.
 */
@Test
public void testDeserializeContainerModelOnlyContainerId() throws IOException {
 ObjectNode jobModelJson = buildJobModelJson();
 ObjectNode containerModelJson = (ObjectNode) jobModelJson.get("containers").get("1");
 containerModelJson.remove("processor-id");
 containerModelJson.put("container-id", 1);
 assertEquals(this.jobModel, deserializeFromObjectNode(jobModelJson));
}
org.codehaus.jackson.nodeObjectNoderemove

Javadoc

Method for removing field entry from this ObjectNode. Will return value of the field, if such field existed; null if not.

Popular methods of ObjectNode

  • put
    Method for setting value of a field to specified binary value
  • get
  • getFields
    Method to use for accessing all fields (with both names and values) of this JSON Object.
  • toString
  • putArray
    Method that will construct an ArrayNode and add it as a field of this ObjectNode, replacing old valu
  • has
  • objectNode
  • size
  • <init>
  • arrayNode
  • putObject
    Method that will construct an ObjectNode and add it as a field of this ObjectNode, replacing old val
  • nullNode
  • putObject,
  • nullNode,
  • path,
  • putNull,
  • POJONode,
  • _put,
  • binaryNode,
  • booleanNode,
  • equals

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now