Class NonExpiringSnapshot

java.lang.Object
org.eclipse.handly.snapshot.Snapshot
org.eclipse.handly.snapshot.NonExpiringSnapshot
All Implemented Interfaces:
ISnapshot

public final class NonExpiringSnapshot extends Snapshot
A snapshot that never expires. It never returns null from getContents(); it wraps another snapshot and holds on to its contents.

Protractedly holding on to non-expiring snapshots is not recommended, as they may potentially consume large amount of space.

  • Constructor Details

    • NonExpiringSnapshot

      public NonExpiringSnapshot(ISnapshotProvider provider)
      Takes a snapshot from the given provider and wraps it in a new non-expiring snapshot.
      Parameters:
      provider - a snapshot provider from which a snapshot is to be taken (not null)
      Throws:
      IllegalStateException - if the snapshot could not be created because of an inappropriate state of the snapshot provider
  • Method Details

    • getContents

      public String getContents()
      Returns the cached contents of the wrapped snapshot.

      Protractedly holding on to the returned contents is not recommended, as it may potentially consume significant amount of space.

      Returns:
      the cached contents of the wrapped snapshot (never null)
    • getWrappedSnapshot

      public ISnapshot getWrappedSnapshot()
      Returns the snapshot wrapped by this snapshot.
      Returns:
      the wrapped snapshot (never null)