public class

DelegatingCacheableAvatarSupplier

extends Object
implements CacheableAvatarSupplier
java.lang.Object
   ↳ com.atlassian.bitbucket.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.bitbucket.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()
long getTimestamp()
The timestamp at which the avatar was last modified, in milliseconds.
@Nonnull InputStream open()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.bitbucket.avatar.AvatarSupplier
From interface com.atlassian.bitbucket.avatar.CacheableAvatarSupplier

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 ()

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

@Nonnull public InputStream open ()

Throws
IOException