Class AvatarRequest

java.lang.Object
com.atlassian.bitbucket.avatar.AvatarRequest

public class AvatarRequest extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    AvatarRequest(boolean secure, @javax.validation.constraints.Min(1L) int size)
    useConfigured is defaulted to false
    AvatarRequest(boolean secure, @javax.validation.constraints.Min(1L) int size, boolean useConfigured)
    Constructs a new AvatarRequest for the provided scheme and size.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Retrieves the size desired for the avatar.
    int
     
    boolean
    Retrieves a flag indicating whether avatar URLs should use HTTPS.
    boolean
    Retrieve the URL using the configured base URL.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AvatarRequest

      public AvatarRequest(boolean secure, @Min(1L) @javax.validation.constraints.Min(1L) int size)
      useConfigured is defaulted to false
      Parameters:
      secure - true if avatar URLs should use HTTPS; otherwise, false for HTTP
      size - the height/width of the avatar being requested
      See Also:
    • AvatarRequest

      public AvatarRequest(boolean secure, @Min(1L) @javax.validation.constraints.Min(1L) int size, boolean useConfigured)
      Constructs a new AvatarRequest for the provided scheme and size.

      The secure flag allows the caller to control whether avatar URLs use HTTP or HTTPS. The size controls the dimensions of the avatar returned.

      Parameters:
      secure - true if avatar URLs should use HTTPS; otherwise, false for HTTP
      size - the height/width of the avatar being requested
      useConfigured - whether to use the configured base URL; if false the request context will be used instead
      Throws:
      IllegalArgumentException - if the provided size is less than 1.
      NullPointerException - if the provided scheme is null.
  • Method Details

    • getSize

      public int getSize()
      Retrieves the size desired for the avatar. Avatars are assumed to be square, so the size is used for both the height and the width.
      Returns:
      the size
    • isSecure

      public boolean isSecure()
      Retrieves a flag indicating whether avatar URLs should use HTTPS. If the flag is true, the returned URLs will use HTTPS; otherwise, they will use HTTP.
      Returns:
      the scheme
    • isUseConfigured

      public boolean isUseConfigured()
      Retrieve the URL using the configured base URL. This flag is only applicable to avatar sources which serve from the current application. Avatars hosted remotely ignore this flag
      Returns:
      true if the URL should use the configured base URL. false otherwise
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object