Class AvatarOptions

java.lang.Object
de.kaiserpfalzedv.commons.api.libravatar.AvatarOptions
All Implemented Interfaces:
Serializable

@ConfigurationProperties("libravatar") public class AvatarOptions extends Object implements Serializable

AvatarOptions -- The configuration for libravatar.

Since:
3.0.0 2023-01-19
Author:
rlichti <rlichti@kaiserpfalz-edv.de>
See Also:
  • Constructor Details

    • AvatarOptions

      public AvatarOptions()
  • Method Details

    • builder

      public static AvatarOptions.AvatarOptionsBuilder<?,?> builder()
    • toBuilder

      public AvatarOptions.AvatarOptionsBuilder<?,?> toBuilder()
    • baseUri

      public String baseUri()
      Specifies a custom base URI for HTTP use. The default is to use the official libravatar HTTP server. If you *really* wanted to use a non-free server, you could set this to "http://gravatar.com/avatar/", but why would you do such a thing?
    • secureBaseUri

      public String secureBaseUri()
      Specifies a custom base URI for HTTPS use. The default is to use the official libravatar HTTPS server.
    • useHttps

      public boolean useHttps()
      Produce https:// URIs where possible. This avoids mixed-content warnings in browsers when using libravatar-sharp from within a page served via HTTPS.
    • useSHA256

      public boolean useSHA256()
      Use the SHA256 hash algorithm, rather than MD5. SHA256 is significantly stronger, but is not supported by Gravatar, so libravatar's fallback to Gravatar for missing images will not work. Note that using Avatar.FromOpenID implicitly uses SHA256.
    • defaultImage

      public LibravatarDefaultImage defaultImage()
      URI for a default image, if no image is found for the user. This also accepts any of the "special" values in AvatarDefaultImages
    • imageSize

      public Integer imageSize()
      Size of the image requested. Valid values are between 1 and 512 pixels. The default size is 80 pixels.
    • baseUri

      public AvatarOptions baseUri(String baseUri)
      Specifies a custom base URI for HTTP use. The default is to use the official libravatar HTTP server. If you *really* wanted to use a non-free server, you could set this to "http://gravatar.com/avatar/", but why would you do such a thing?
      Returns:
      this.
    • secureBaseUri

      public AvatarOptions secureBaseUri(String secureBaseUri)
      Specifies a custom base URI for HTTPS use. The default is to use the official libravatar HTTPS server.
      Returns:
      this.
    • useHttps

      public AvatarOptions useHttps(boolean useHttps)
      Produce https:// URIs where possible. This avoids mixed-content warnings in browsers when using libravatar-sharp from within a page served via HTTPS.
      Returns:
      this.
    • useSHA256

      public AvatarOptions useSHA256(boolean useSHA256)
      Use the SHA256 hash algorithm, rather than MD5. SHA256 is significantly stronger, but is not supported by Gravatar, so libravatar's fallback to Gravatar for missing images will not work. Note that using Avatar.FromOpenID implicitly uses SHA256.
      Returns:
      this.
    • defaultImage

      public AvatarOptions defaultImage(LibravatarDefaultImage defaultImage)
      URI for a default image, if no image is found for the user. This also accepts any of the "special" values in AvatarDefaultImages
      Returns:
      this.
    • imageSize

      public AvatarOptions imageSize(Integer imageSize)
      Size of the image requested. Valid values are between 1 and 512 pixels. The default size is 80 pixels.
      Returns:
      this.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object