Java Code Examples for org.springframework.beans.Mergeable#isMergeEnabled()

The following examples show how to use org.springframework.beans.Mergeable#isMergeEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConstructorArgumentValues.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
Example 2
Source File: ConstructorArgumentValues.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
Example 3
Source File: ConstructorArgumentValues.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
Example 4
Source File: ConstructorArgumentValues.java    From blog_demos with Apache License 2.0 6 votes vote down vote up
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
Example 5
Source File: ConstructorArgumentValues.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
Example 6
Source File: ConstructorArgumentValues.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}
 
Example 7
Source File: ConstructorArgumentValues.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}
 
Example 8
Source File: ConstructorArgumentValues.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}
 
Example 9
Source File: ConstructorArgumentValues.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}
 
Example 10
Source File: ConstructorArgumentValues.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}