Interface LastModifiedCallback

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface LastModifiedCallback
Describes a callback for receiving the commits that last modified a set of files.
Since:
4.6
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Called after the final file's last modification has been streamed.
    boolean
    onFile(String file, Commit commit)
    Receives a fully-populated commit which last modified the specified file.
    default void
    Called before the first file is streamed.
  • Method Details

    • onEnd

      default void onEnd(@Nonnull LastModifiedSummary summary) throws IOException
      Called after the final file's last modification has been streamed.

      Note: If the requested path contained no files, this method may be called immediately after onStart(LastModifiedContext) without any calls to onFile(String, Commit).

      Parameters:
      summary - summarizes the request and provides the most recent commit to modify the requested path
      Throws:
      IOException - for implementations which perform I/O
    • onFile

      boolean onFile(@Nonnull String file, @Nonnull Commit commit) throws IOException
      Receives a fully-populated commit which last modified the specified file. Files are provided as relative to the requested path, and only files are provided. Subdirectories of the requested path are not streamed.

      This method will never be invoked before onStart(LastModifiedContext), and if it is invoked onEnd(LastModifiedSummary) is guaranteed to be invoked, whether the end happens because this method returns false or because the upstream sender runs out of modifications.

      Parameters:
      file - a relative path to the modified file
      commit - the last commit to modify the file
      Returns:
      true if more modifications should be provided; otherwise, false to end streaming, potentially leaving some number of modifications unread
      Throws:
      IOException - for implementations which perform I/O
    • onStart

      default void onStart(@Nonnull LastModifiedContext context) throws IOException
      Called before the first file is streamed.
      Parameters:
      context - provides details about the request
      Throws:
      IOException - for implementations which perform I/O