Class MergeResult<T>
- java.lang.Object
-
- org.cadixdev.lorenz.merge.MergeResult<T>
-
- Type Parameters:
T- The type of the result of the merge handler.
public class MergeResult<T> extends java.lang.ObjectThis class represents the result of a mapping merge handled by a
MappingSetMergerHandler. This class is only relevant to mapping types which have children, which includes both top level and inner class mappings, and method mappings.This class holds 2 values:
- The merge result
- The child mappings on the right to merge into the merge result with the left side of the merge
When a merge occurs with mappings which contain child data the merger will need to recurse into the child data and merge those mappings too. Depending on the situation this may not be desirable, or you may wish to control specifically which mappings do or don't get merged. Typically there will only be one mapping on the right side, but some situations, such as duplicates and method mappings, may have multiple mappings that you may want merged. By storing those mappings in a list in that class that allows the merger to have the most flexibility in choosing which mappings are or aren't merged.
- Since:
- 0.5.4
- API Note:
- This class should only contains the mappings on the right side of the merge which should be mapped. The left side is considered the source and is always mapped.
-
-
Constructor Summary
Constructors Constructor Description MergeResult(T result)Create a newMergeResultwith a result and no mappings to merge.MergeResult(T result, java.util.List<T> mappingsToMap)Create a newMergeResultwith a result and a list of mappings to merge.MergeResult(T result, T mappingToMerge)Create a newMergeResultwith a result and only one mapping to merge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<T>getMappingsToMap()TgetResult()java.lang.StringtoString()
-
-
-
Constructor Detail
-
MergeResult
public MergeResult(T result)
Create a newMergeResultwith a result and no mappings to merge.- Parameters:
result- The result of the merge operation, may benull.
-
MergeResult
public MergeResult(T result, T mappingToMerge)
Create a newMergeResultwith a result and only one mapping to merge.- Parameters:
result- The result of the merge operation, may benull.mappingToMerge- The mapping to merge into theresult, must not benull.
-
MergeResult
public MergeResult(T result, java.util.List<T> mappingsToMap)
Create a newMergeResultwith a result and a list of mappings to merge.- Parameters:
result- The result of the merge operation, may benull.mappingsToMap- The mappings to merge into theresult, must not benull, and no entries may benull. May be empty.
-
-
Method Detail
-
getResult
public T getResult()
- Returns:
- The returned result of the duplicate merge action, may be
null.
-
getMappingsToMap
public java.util.List<T> getMappingsToMap()
- Returns:
- The mappings to map child entries from into the new mapping returned by
getResult(). Cannot benull.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-