MutableEditsDraft


public final class MutableEditsDraft extends EditsDraft


A mutable builder for creating a sequence of draft edit operations.

Summary

Public constructors

Public methods

final void

Enqueues a insert operation for a new PdfAnnotation.

final void
remove(@NonNull String annotationId, int pageNum)

Enqueues a 'remove' operation for an existing annotation.

final @NonNull EditsDraft

Transforms the enqueued edits to an immutable request.

final void
update(@NonNull String annotationId, @NonNull PdfAnnotation annotation)

Enqueues an 'update' operation for an existing annotation.

Inherited methods

From androidx.pdf.EditsDraft
boolean
equals(Object other)
int
final @NonNull Pair<@NonNull EditsDraft, @NonNull EditsDraft>
splitAt(int index)

Splits this EditsDraft into two separate drafts at the specified index with bounds [0, index) and [index, n).

Public constructors

MutableEditsDraft

Added in 1.0.0-alpha19
public MutableEditsDraft()

Public methods

insert

Added in 1.0.0-alpha19
public final void insert(@NonNull PdfAnnotation annotation)

Enqueues a insert operation for a new PdfAnnotation.

Parameters
@NonNull PdfAnnotation annotation

The PdfAnnotation to be created.

remove

Added in 1.0.0-alpha19
public final void remove(@NonNull String annotationId, int pageNum)

Enqueues a 'remove' operation for an existing annotation.

Parameters
@NonNull String annotationId

The id of the annotation to be removed.

int pageNum

The page number where the annotation is located.

toEditsDraft

Added in 1.0.0-alpha19
public final @NonNull EditsDraft toEditsDraft()

Transforms the enqueued edits to an immutable request.

Returns
@NonNull EditsDraft

An EditsDraft containing the accumulated operations.

update

Added in 1.0.0-alpha19
public final void update(@NonNull String annotationId, @NonNull PdfAnnotation annotation)

Enqueues an 'update' operation for an existing annotation.

Parameters
@NonNull String annotationId

The id of the annotation to be updated.

@NonNull PdfAnnotation annotation

The new PdfAnnotation data for the update.