Class AvatarImpl

java.lang.Object
com.atlassian.jira.avatar.AvatarImpl
All Implemented Interfaces:
Avatar

public final class AvatarImpl extends Object implements Avatar
Immutable implementation.
Since:
v4.0
  • Method Details

    • createCustomAvatar

      public static AvatarImpl createCustomAvatar(String fileName, String contentType, String ownerId, IconType iconType)
    • createSystemAvatar

      public static AvatarImpl createSystemAvatar(String fileName, String contentType, IconType iconType)
      Factory method for creating a system Avatar to be created by AvatarManager.
    • getAvatarType

      @Nonnull public Avatar.Type getAvatarType()
      Description copied from interface: Avatar
      Returns the avatar type.

      Since v7.1 plugins can add avatars to arbitrary entities. The enum will just return Avatar.Type.OTHER if the Avatar is for a custom entity.

      Specified by:
      getAvatarType in interface Avatar
      Returns:
      a non null Avatar.Type.
    • getIconType

      @Nonnull public IconType getIconType()
      Description copied from interface: Avatar
      Get the icon type.
      Specified by:
      getIconType in interface Avatar
      Returns:
      The type of the icon.
    • getFileName

      public String getFileName()
      Description copied from interface: Avatar
      The base filename to the avatar image file. The actual file name will be modified with the id etc.
      Specified by:
      getFileName in interface Avatar
      Returns:
      the non null file name.
    • getContentType

      @Nonnull public String getContentType()
      Description copied from interface: Avatar
      The MIME type of the avatar image file.
      Specified by:
      getContentType in interface Avatar
      Returns:
      the non null file name.
    • getId

      public Long getId()
      Description copied from interface: Avatar
      The database identifier for the Avatar, may be null if it hasn't yet been stored or if database identifiers are not supported. This will always return null for user avatars in some deployment configurations. Avatars for other purposes (e.g. Projects) may follow this in future versions and this method will be deprecated entirely. The id should not be used to construct URLs to the currently-configured avatar for anything. This method should only be used when it is necessary to refer to an avatar that is not currently the configured avatar for the domain object. The only use cases where this is needed are those to do with modifying or viewing detailed avatar configuration.
      Specified by:
      getId in interface Avatar
      Returns:
      the database id or null.
    • getOwner

      public String getOwner()
      Description copied from interface: Avatar
      Returns the identity of the domain object that this avatar is an avatar for.

      For example, if it is a user avatar, it would be the user key (since that is the primary key), for a Project it is the project ID as a String. The meaning of this should be determined by the IconType.

      For a non-system avatar (see Avatar.isSystemAvatar()}, the owner is never null. For a system avatar, the owner is always null.

      Specified by:
      getOwner in interface Avatar
      Returns:
      the ID of the domain object that this is the avatar for.
    • isSystemAvatar

      public boolean isSystemAvatar()
      Description copied from interface: Avatar
      Indicates whether the Avatar is a system-provided one or if users have defined it.
      Specified by:
      isSystemAvatar in interface Avatar
      Returns:
      true only if the Avatar is a system-provided one.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object