Class ObjectMerger
Useful in cases where you want to define beans with 'default' values.
For example, given the following bean classes...
The getters will be called in order until the first non-null value is returned...
Notes:
- Null POJOs are ignored.
-
Non-getter methods are either invoked on the first POJO or all POJOs depending on the
callAllNonGetters flag passed into the constructor. -
For purposes of this interface, a getter is any method with zero arguments and a non-
void return type.
See Also:
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ObjectMerger
public ObjectMerger()
-
-
Method Details
-
merge
Create a proxy interface on top of zero or more POJOs.This is a shortcut to calling
merge(interfaceClass,
false , pojos);- Type Parameters:
T
- The pojo types.- Parameters:
interfaceClass
- The common interface class.pojos
- Zero or more POJOs to merge.
Can contain nulls.- Returns:
- A proxy interface over the merged POJOs.
-
merge
Create a proxy interface on top of zero or more POJOs.- Type Parameters:
T
- The pojo types.- Parameters:
interfaceClass
- The common interface class.callAllNonGetters
- Iftrue , when calling a method that's not a getter, the method will be invoked on all POJOs.
Otherwise, the method will only be called on the first POJO.pojos
- Zero or more POJOs to merge.
Can contain nulls.- Returns:
- A proxy interface over the merged POJOs.
-