Class LoadContext


  • public class LoadContext
    extends Object
    The context of a load operation, which may extend across several entities (for example, a batch).
    • Constructor Detail

      • LoadContext

        public LoadContext​(LoadEngine engine)
    • Method Detail

      • useRecycled

        public Object useRecycled()
        The most recently recycled value. It can be used exactly once.
      • recycle

        public void recycle​(Object value)
      • setCurrentRoot

        public void setCurrentRoot​(Key<?> rootEntity)
        Sets the current root entity
      • done

        public void done()
        Call this when a load process completes. Executes anything in the batch and then executes any delayed operations.
      • loadRef

        public <T> Ref<T> loadRef​(Key<T> key,
                                  LoadConditions loadConditions)
        Create a Ref for the key, and maybe start a load operation depending on current load groups.
      • defer

        public void defer​(Runnable runnable)
        Delays an operation until the context is done(). Typically this is for lifecycle methods.
      • getContainer

        public Object getContainer​(Type containerType,
                                   Path path)
        Get the container object which is appropriate for the specified property. Go up the chain looking for a compatible type; the first one found is the container. If nothing found, throw an exception.
      • enterContainerContext

        public void enterContainerContext​(Object container)
        Enter a container context; this is the context of the object that we are processing right now.
      • exitContainerContext

        public void exitContainerContext​(Object expectedContainer)
        Exit a container context. The parameter is just a sanity check to make sure that the value popped off is the same as the value we expect.