org.apache.commons.configuration2.tree.NodeUpdateData Maven / Gradle / Ivy
Show all versions of commons-configuration2 Show documentation
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.configuration2.tree;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
*
* A simple data class used by node models to store parameters of an update
* operation.
*
*
* The {@code Configuration} interface provides a method for setting the value
* of a given key. The passed in value can be a single object or a collection of
* values. This makes an update operation rather complicated because a
* collection of query results selected by the passed in key has to be matched
* to another collection of values - and both collections can have different
* sizes. Therefore, an update operation may involve changing of existing nodes,
* adding new nodes (if there are more values than currently existing nodes),
* and removing nodes (if there are more existing nodes than provided values).
* This class collects all this information making it possible to actually
* perform the update based on a passed in instance.
*
*
* @since 2.0
* @param the type of nodes involved in this update operation
*/
public class NodeUpdateData
{
/** The map with the query results whose value has to be changed. */
private final Map, Object> changedValues;
/** The collection with the new values to be added. */
private final Collection