public class

DelegatingCacheableAvatarSupplier

extends Object
implements CacheableAvatarSupplier
java.lang.Object
   ↳ com.atlassian.stash.avatar.DelegatingCacheableAvatarSupplier

Class Overview

An CacheableAvatarSupplier implementation which delegates to an AvatarSupplier, storing the avatar's modification timestamp separately. This class can be used to promote an ordinary AvatarSupplier to a CacheableAvatarSupplier.

Summary

[Expand]
Inherited Constants
From interface com.atlassian.stash.avatar.CacheableAvatarSupplier
Public Constructors
DelegatingCacheableAvatarSupplier(AvatarSupplier supplier)
Constructs a new DelegatingCacheableAvatarSupplier with an unknown timestamp.
DelegatingCacheableAvatarSupplier(AvatarSupplier supplier, long timestamp)
Constructs a new DelegatingCacheableAvatarSupplier with the provided timestamp.
Public Methods
String getContentType()
@Nonnull InputStream getInput()
long getTimestamp()
The timestamp at which the avatar was last modified, in milliseconds.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.stash.avatar.AvatarSupplier
From interface com.atlassian.stash.avatar.CacheableAvatarSupplier
From interface com.google.common.io.InputSupplier

Public Constructors

public DelegatingCacheableAvatarSupplier (AvatarSupplier supplier)

Constructs a new DelegatingCacheableAvatarSupplier with an unknown timestamp.

Parameters
supplier the AvatarSupplier containing the avatar's content type and InputStream

public DelegatingCacheableAvatarSupplier (AvatarSupplier supplier, long timestamp)

Constructs a new DelegatingCacheableAvatarSupplier with the provided timestamp.

Parameters
supplier the AvatarSupplier containing the avatar's content type and InputStream
timestamp the avatar's modification timestamp, which may be TIMESTAMP_UNKNOWN if no modification timestamp is known, or TIMESTAMP_ETERNAL if the avatar is unmodifiable

Public Methods

public String getContentType ()

@Nonnull public InputStream getInput ()

Throws
IOException

public long getTimestamp ()

The timestamp at which the avatar was last modified, in milliseconds.

To account for differences in avatar repository implementations:

  • If timestamp information is not available, implementations shall return TIMESTAMP_UNKNOWN. Avatars without timestamps should not be cached, as it may not be possible to reliably detect updates.
  • If the avatar cannot be updated, implementations shall return TIMESTAMP_ETERNAL. Such avatars may be cached more aggressively, as they cannot change.

Returns