public interface

ChangeCallback

com.atlassian.stash.content.ChangeCallback
Known Indirect Subclasses

Class Overview

Describes a callback for receiving streaming changes.

Implementations of this callback performing internal paging may return false from onChange(Change) to indicate no more changes are desired. Such implementations are encouraged to also implement the PagedCallback interface to allow the system to optimise output handling, where possible, based on the page being requested.

Note: Implementors are strongly encouraged to extend from AbstractChangeCallback. This interface will change, over time, and any class implementing it directly will be broken by such changes. Extending from the abstract class will help prevent such breakages.

Summary

Public Methods
boolean onChange(Change change)
Provides a change to the callback for processing.
@Deprecated void onEnd(boolean truncated)
This method is deprecated. in 2.10 for removal in 3.0. Callbacks should extend AbstractChangeCallback and implement onEnd(ChangeSummary) instead
@Deprecated void onStart()
This method is deprecated. in 2.10 for removal in 3.0. Callbacks should extend AbstractChangeCallback and implement onStart(ChangeContext) instead.

Public Methods

public boolean onChange (Change change)

Provides a change to the callback for processing.

If the callback is performing internal paging, it may signal the end of the page by returning false here. When doing so, onEnd(boolean) will never receive true for truncation.

Parameters
change the change to process
Returns
  • true if additional changes should be provided; otherwise, false if the callback has received as many changes as desired
Throws
IOException may be thrown by implementations which perform I/O

@Deprecated public void onEnd (boolean truncated)

This method is deprecated.
in 2.10 for removal in 3.0. Callbacks should extend AbstractChangeCallback and implement onEnd(ChangeSummary) instead

Informs the callback that no more changes are available.

Note: The system applies a hard cap to the number of changes it is willing to stream, regardless of how many the callback is willing to consume. If that cap is reached, truncated will be set to true to indicate that there are more changes available than have been streamed, but the system is unwilling to provide them. Note that if onChange(Change) returns false, that is not considered truncation.

Parameters
truncated true if the changes were truncated by the system and at least one change was not streamed to the callback; otherwise, false if all available changes have been streamed or if the callback requested streaming end
Throws
IOException may be thrown by implementations which perform I/O

@Deprecated public void onStart ()

This method is deprecated.
in 2.10 for removal in 3.0. Callbacks should extend AbstractChangeCallback and implement onStart(ChangeContext) instead.

Informs the callback that the system has begun processing changes and may begin streaming them. If there are no changes available, this method may be followed immediately by onEnd(boolean).

This method will always be invoked before onChange(Change) is invoked for the first time.

onStart(ChangeContext) will replace this method in Stash 3.0.

Throws
IOException may be thrown by implementations which perform I/O