Class AggregateChange<T>

  • All Implemented Interfaces:
    Change<T>

    public class AggregateChange<T>
    extends java.lang.Object
    implements Change<T>
    Aggregates multiple Change instances into a single Change.
    Author:
    Daniel Sagenschneider
    • Constructor Detail

      • AggregateChange

        public AggregateChange​(T target,
                               java.lang.String changeDescription,
                               Change<?>... changes)
        Initiate.
        Parameters:
        target - Target.
        changeDescription - Change description.
        changes - Change instances.
    • Method Detail

      • aggregate

        public static <T> Change<T> aggregate​(Change<T> change,
                                              Change<?>... changes)
        Aggregates the Change instances, basing resulting Change on first Change.
        Type Parameters:
        T - Target type.
        Parameters:
        change - First Change.
        changes - Further Change instances to aggregate.
        Returns:
        Change aggregating the input Change instances.
      • getTarget

        public T getTarget()
        Description copied from interface: Change
        Obtains the target to which this Change applies.
        Specified by:
        getTarget in interface Change<T>
        Returns:
        Target to which this Change applies.
      • getChangeDescription

        public java.lang.String getChangeDescription()
        Description copied from interface: Change
        Obtains a description of the Change.
        Specified by:
        getChangeDescription in interface Change<T>
        Returns:
        Description of the Change.
      • apply

        public void apply()
        Description copied from interface: Change
        Applies this Change.
        Specified by:
        apply in interface Change<T>
      • revert

        public void revert()
        Description copied from interface: Change

        Reverts this Change (after being applied).

        This enables do/undo functionality.

        Specified by:
        revert in interface Change<T>
      • getConflicts

        public Conflict[] getConflicts()
        Description copied from interface: Change

        Obtains the Conflict instances preventing this Change from being applied.

        A Change can only be applied if this returns an empty array.

        Specified by:
        getConflicts in interface Change<T>
        Returns:
        Any Conflict instances preventing applying this Change.