Class PerFieldMergeState


  • final class PerFieldMergeState
    extends java.lang.Object
    Utility class to update the MergeState instance to be restricted to a set of fields.

    Warning: the input MergeState instance will be updated when calling apply(Collection).

    It should be called within a try {...} finally {...} block to make sure that the mergeState instance is restored to its original state:

     PerFieldMergeState pfMergeState = new PerFieldMergeState(mergeState);
     try {
       doSomething(pfMergeState.apply(fields));
       ...
     } finally {
       pfMergeState.reset();
     }
     
    • Constructor Detail

      • PerFieldMergeState

        PerFieldMergeState​(MergeState in)
    • Method Detail

      • apply

        MergeState apply​(java.util.Collection<java.lang.String> fields)
        Update the input MergeState instance to restrict the fields to the given ones.
        Parameters:
        fields - The fields to keep in the updated instance.
        Returns:
        The updated instance.
      • reset

        MergeState reset()
        Resets the input MergeState instance to its original state.
        Returns:
        The reset instance.