/** * Add a generic argument value to be matched by type or name (if available). * <p>Note: A single generic argument value will just be used once, * rather than matched multiple times. * @param newValue the argument value in the form of a ValueHolder * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addGenericArgumentValue(ValueHolder newValue) { Assert.notNull(newValue, "ValueHolder must not be null"); if (!this.genericArgumentValues.contains(newValue)) { addOrMergeGenericArgumentValue(newValue); } }
/** * Add a generic argument value to be matched by type or name (if available). * <p>Note: A single generic argument value will just be used once, * rather than matched multiple times. * @param newValue the argument value in the form of a ValueHolder * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addGenericArgumentValue(ValueHolder newValue) { Assert.notNull(newValue, "ValueHolder must not be null"); if (!this.genericArgumentValues.contains(newValue)) { addOrMergeGenericArgumentValue(newValue); } }
/** * Copy all given argument values into this object, using separate holder * instances to keep the values independent from the original object. * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addArgumentValues(@Nullable ConstructorArgumentValues other) { if (other != null) { other.indexedArgumentValues.forEach( (index, argValue) -> addOrMergeIndexedArgumentValue(index, argValue.copy()) ); other.genericArgumentValues.stream() .filter(valueHolder -> !this.genericArgumentValues.contains(valueHolder)) .forEach(valueHolder -> addOrMergeGenericArgumentValue(valueHolder.copy())); } }
/** * Copy all given argument values into this object, using separate holder * instances to keep the values independent from the original object. * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addArgumentValues(@Nullable ConstructorArgumentValues other) { if (other != null) { other.indexedArgumentValues.forEach( (index, argValue) -> addOrMergeIndexedArgumentValue(index, argValue.copy()) ); other.genericArgumentValues.stream() .filter(valueHolder -> !this.genericArgumentValues.contains(valueHolder)) .forEach(valueHolder -> addOrMergeGenericArgumentValue(valueHolder.copy())); } }
/** * Add a generic argument value to be matched by type or name (if available). * <p>Note: A single generic argument value will just be used once, * rather than matched multiple times. * @param newValue the argument value in the form of a ValueHolder * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addGenericArgumentValue(ValueHolder newValue) { Assert.notNull(newValue, "ValueHolder must not be null"); if (!this.genericArgumentValues.contains(newValue)) { addOrMergeGenericArgumentValue(newValue); } }
/** * Copy all given argument values into this object, using separate holder * instances to keep the values independent from the original object. * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addArgumentValues(ConstructorArgumentValues other) { if (other != null) { for (Map.Entry<Integer, ValueHolder> entry : other.indexedArgumentValues.entrySet()) { addOrMergeIndexedArgumentValue(entry.getKey(), entry.getValue().copy()); } for (ValueHolder valueHolder : other.genericArgumentValues) { if (!this.genericArgumentValues.contains(valueHolder)) { addOrMergeGenericArgumentValue(valueHolder.copy()); } } } }
/** * Add a generic argument value to be matched by type or name (if available). * <p>Note: A single generic argument value will just be used once, * rather than matched multiple times. * @param newValue the argument value in the form of a ValueHolder * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addGenericArgumentValue(ValueHolder newValue) { Assert.notNull(newValue, "ValueHolder must not be null"); if (!this.genericArgumentValues.contains(newValue)) { addOrMergeGenericArgumentValue(newValue); } }
/** * Copy all given argument values into this object, using separate holder * instances to keep the values independent from the original object. * <p>Note: Identical ValueHolder instances will only be registered once, * to allow for merging and re-merging of argument value definitions. Distinct * ValueHolder instances carrying the same content are of course allowed. */ public void addArgumentValues(ConstructorArgumentValues other) { if (other != null) { for (Map.Entry<Integer, ValueHolder> entry : other.indexedArgumentValues.entrySet()) { addOrMergeIndexedArgumentValue(entry.getKey(), entry.getValue().copy()); } for (ValueHolder valueHolder : other.genericArgumentValues) { if (!this.genericArgumentValues.contains(valueHolder)) { addOrMergeGenericArgumentValue(valueHolder.copy()); } } } }