Interface SingularChangeModel<E>

Type Parameters:
E - The element type represented by the change model
All Superinterfaces:
ChangeModel<E>

public interface SingularChangeModel<E>
extends ChangeModel<E>
An interface for accessing the dirty state of an object.
Since:
1.2.0
Author:
Christian Beikov
  • Method Details

    • getDirtyChanges

      List<ChangeModel<?>> getDirtyChanges()
      Returns the change models of the dirty nested attributes.
      Returns:
      The dirty change models
      Throws:
      IllegalStateException - if invoked on a change model that corresponds to a basic attribute
    • get

      <X> ChangeModel<X> get​(String attributePath)
      Returns the change model for the attribute.
      Type Parameters:
      X - The element type of the target attribute path
      Parameters:
      attributePath - The name of the attribute or path to sub-attribute
      Returns:
      The change model for the attribute
      Throws:
      IllegalStateException - if invoked on a change model that corresponds to a basic attribute
      IllegalArgumentException - if attribute of the given name does not otherwise exist
    • getAll

      <X> List<? extends ChangeModel<X>> getAll​(String attributePath)
      Returns the change model for the attribute.
      Type Parameters:
      X - The element type of the target attribute path
      Parameters:
      attributePath - The name of the attribute or path to sub-attribute
      Returns:
      The change model for the attribute
      Throws:
      IllegalStateException - if invoked on a change model that corresponds to a basic attribute
      IllegalArgumentException - if attribute of the given name does not otherwise exist
    • get

      @Deprecated <X> SingularChangeModel<X> get​(SingularAttribute<E,​X> attribute)
      Returns the change model for the attribute.
      Type Parameters:
      X - The element type of the singular attribute
      Parameters:
      attribute - The singular attribute
      Returns:
      The change model for the attribute
    • get

      @Deprecated <V,​ C extends Collection<V>> PluralChangeModel<C,​V> get​(PluralAttribute<E,​C,​V> attribute)
      Returns the change model for the attribute.
      Type Parameters:
      C - The container type of the plural attribute
      V - The value type of the plural attribute
      Parameters:
      attribute - The collection attribute
      Returns:
      The change model for the attribute
    • get

      @Deprecated <K,​ V> MapChangeModel<K,​V> get​(MapAttribute<E,​K,​V> attribute)
      Deprecated.
      Returns the change model for the attribute.
      Type Parameters:
      K - The key type of the map attribute
      V - The value type of the map attribute
      Parameters:
      attribute - The map attribute
      Returns:
      The change model for the attribute
    • get

      <X> SingularChangeModel<X> get​(MethodSingularAttribute<E,​X> attribute)
      Returns the change model for the attribute.
      Type Parameters:
      X - The element type of the singular attribute
      Parameters:
      attribute - The singular attribute
      Returns:
      The change model for the attribute
      Since:
      1.5.0
    • get

      <V,​ C extends Collection<V>> PluralChangeModel<C,​V> get​(MethodPluralAttribute<E,​C,​V> attribute)
      Returns the change model for the attribute.
      Type Parameters:
      C - The container type of the plural attribute
      V - The value type of the plural attribute
      Parameters:
      attribute - The collection attribute
      Returns:
      The change model for the attribute
      Since:
      1.5.0
    • get

      <K,​ V> MapChangeModel<K,​V> get​(MethodMapAttribute<E,​K,​V> attribute)
      Returns the change model for the attribute.
      Type Parameters:
      K - The key type of the map attribute
      V - The value type of the map attribute
      Parameters:
      attribute - The map attribute
      Returns:
      The change model for the attribute
      Since:
      1.5.0
    • isDirty

      boolean isDirty​(String attributePath)
      Returns whether the change model for the attribute is dirty. Essentially, this is a more efficient short-hand for get(attributePath).isDirty().
      Parameters:
      attributePath - The name of the attribute or path to sub-attribute
      Returns:
      True if the change model for the attribute path is dirty, false otherwise
      Throws:
      IllegalStateException - if invoked on a change model that corresponds to a basic attribute
      IllegalArgumentException - if attribute of the given name does not otherwise exist
    • isChanged

      boolean isChanged​(String attributePath)
      Returns whether the target attribute path was changed by updating or mutating it, but still has the same identity regarding parent objects it is contained in. If any of the parent objects as denoted by the attribute path are updated i.e. the identity was changed, this returns true. Mutations or updates to the target object also cause true to be returned. In all other cases, this method returns false.
      Parameters:
      attributePath - The name of the attribute or path to sub-attribute
      Returns:
      True if the attribute was changed, false otherwise
      Throws:
      IllegalStateException - if invoked on a change model that corresponds to a basic attribute
      IllegalArgumentException - if attribute of the given name does not otherwise exist