Class AggregateChange<T>

  • All Implemented Interfaces:

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

      • AggregateChange

        public AggregateChange​(T target,
                               java.lang.String changeDescription,
                               Change<?>... changes)
        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.
        change - First Change.
        changes - Further Change instances to aggregate.
        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>
        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>
        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>
        Any Conflict instances preventing applying this Change.