Class AbstractChange<T>

java.lang.Object
net.officefloor.model.impl.change.AbstractChange<T>
All Implemented Interfaces:
Change<T>
Direct Known Subclasses:
DisconnectChange, NoChange

public abstract class AbstractChange<T> extends Object implements Change<T>
Abstract Change.
Author:
Daniel Sagenschneider
  • Constructor Details

    • AbstractChange

      public AbstractChange(T target, String changeDescription)
      Initiate.
      Parameters:
      target - Target of the Change.
      changeDescription - Description of the Change.
    • AbstractChange

      public AbstractChange(T target, String changeDescription, Conflict[] conflicts)
      Initiate.
      Parameters:
      target - Target of the Change.
      changeDescription - Description of the Change.
      conflicts - Conflict instances preventing the Change from being applied.
  • Method Details

    • setConflicts

      protected void setConflicts(Conflict[] conflicts)
      Specifies the Conflict instances.
      Parameters:
      conflicts - Conflict 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 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.
    • canApply

      public boolean canApply()
      Description copied from interface: Change

      Indicates if can apply this Change.

      Typically there will be Conflict instances providing detail on why the Change can not be applied.

      Specified by:
      canApply in interface Change<T>
      Returns:
      true if can apply this Change.
      See Also:
    • 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.