Interface SCO<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void attachCopy​(T value)
      Method to return an attached copy of this object.
      Object clone()
      Mutable second class objects are required to provide a public clone() method so that copying of persistable objects can take place.
      T detachCopy​(FetchPlanState state)
      Method to return a detached copy of this object.
      String getFieldName()
      Accessor for the field name.
      Object getOwner()
      Accessor for the owner object of the SCO instance.
      T getValue()
      Method to return the value of the unwrapped type.
      void initialise()
      Method to initialise the SCO for use, and allowing the SCO to be loaded from the datastore (when we have a backing store).
      void initialise​(T value)
      Method to initialise the SCO for use with the provided initial value.
      void initialise​(T newValue, Object oldValue)
      Method to initialise the SCO for use, where replacing an old value with a new value such as when calling a setter field passing in a new value.
      void unsetOwner()
      Nullifies references to the owner Object and field.
    • Method Detail

      • initialise

        void initialise​(T value)
        Method to initialise the SCO for use with the provided initial value. This is used, for example, when retrieving the field from the datastore and setting it in the persistable object.
        Parameters:
        value - the object from which to copy the value.
      • initialise

        void initialise()
        Method to initialise the SCO for use, and allowing the SCO to be loaded from the datastore (when we have a backing store). This can be utilised to perform any eager loading of information from the datastore.
      • initialise

        void initialise​(T newValue,
                        Object oldValue)
        Method to initialise the SCO for use, where replacing an old value with a new value such as when calling a setter field passing in a new value. Note that oldValue is marked as Object since for cases where the member type is Collection the newValue could be, for example, ArrayList, and the oldValue of type Collection (representing null).
        Parameters:
        newValue - New value (to wrap)
        oldValue - Old value (to use in deciding what needs deleting etc)
      • getFieldName

        String getFieldName()
        Accessor for the field name.
        Returns:
        field name, or null if no longer associated with an object
      • getOwner

        Object getOwner()
        Accessor for the owner object of the SCO instance. Is typically a persistable object.
        Returns:
        owner object, or null if no longer associated with an object
      • unsetOwner

        void unsetOwner()
        Nullifies references to the owner Object and field. Thereafter the SCO is no longer associated with the owner and thus should not issue any request to the datastore.
      • getValue

        T getValue()
        Method to return the value of the unwrapped type.
        Returns:
        The value that is wrapped by this object.
      • clone

        Object clone()
        Mutable second class objects are required to provide a public clone() method so that copying of persistable objects can take place. This mustn't throw a CloneNotSupportedException.
        Returns:
        A clone of the object
      • detachCopy

        T detachCopy​(FetchPlanState state)
        Method to return a detached copy of this object. Detaches all components of this object that are also persistable.
        Parameters:
        state - State of the detachment process
        Returns:
        The detached copy
      • attachCopy

        void attachCopy​(T value)
        Method to return an attached copy of this object. Attaches all components of this object that are also persistable.
        Parameters:
        value - The object value from the detached instance