Interface RelationshipManager

  • All Known Implementing Classes:
    RelationshipManagerImpl

    public interface RelationshipManager
    Manager for (bidirectional) relationships of an object (StateManager). Designed as a stand-alone process to run just before flush. Updates on bidirectional relations are registered during the persistence process. Call to checkConsistency() will check for consistency and throw exceptions as appropriate. Call to process() will perform updates at the other side of the registered relations so all is consistent. TODO Cater for Map put/remove calls TODO Consider sharing info with org.datanucleus.flush.OperationQueue which holds similar information (but only when optimistic)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void checkConsistency()
      Method to check for consistency the managed relations of this object with the related objects.
      void clearFields()
      Convenience method to clear all fields from being managed.
      boolean managesField​(int fieldNumber)
      Accessor for whether a field is being managed.
      void process()
      Method to process the (bidirectional) relations for this object.
      void relationAdd​(int fieldNumber, Object val)
      Method to register a change in the contents of a container field, with an object being added.
      void relationChange​(int fieldNumber, Object oldValue, Object newValue)
      Method that is called when the user calls setXXX() on a field.
      void relationRemove​(int fieldNumber, Object val)
      Method to register a change in the contents of a container field, with an object being removed.
    • Method Detail

      • clearFields

        void clearFields()
        Convenience method to clear all fields from being managed.
      • relationChange

        void relationChange​(int fieldNumber,
                            Object oldValue,
                            Object newValue)
        Method that is called when the user calls setXXX() on a field.
        Parameters:
        fieldNumber - Number of the field
        oldValue - The old value
        newValue - The new value
      • relationAdd

        void relationAdd​(int fieldNumber,
                         Object val)
        Method to register a change in the contents of a container field, with an object being added.
        Parameters:
        fieldNumber - Number of the field
        val - Value being added
      • relationRemove

        void relationRemove​(int fieldNumber,
                            Object val)
        Method to register a change in the contents of a container field, with an object being removed.
        Parameters:
        fieldNumber - Number of the field
        val - Value being removed
      • managesField

        boolean managesField​(int fieldNumber)
        Accessor for whether a field is being managed.
        Parameters:
        fieldNumber - Number of the field
        Returns:
        Whether it is currently managed
      • checkConsistency

        void checkConsistency()
        Method to check for consistency the managed relations of this object with the related objects.
      • process

        void process()
        Method to process the (bidirectional) relations for this object.