Package alpine.util

Class GravatarUtil


  • public final class GravatarUtil
    extends Object
    A collection of methods that help integrate user Gravatar's.
    Since:
    1.0.0
    Author:
    Steve Springett
    • Method Detail

      • generateHash

        public static String generateHash​(String emailAddress)
        Generates a hash value from the specified email address. Returns null if emailAddress is empty or null.
        Parameters:
        emailAddress - the email address to generate a hash from
        Returns:
        a hash value of the specified email address
        Since:
        1.0.0
      • getGravatarUrl

        public static String getGravatarUrl​(UserPrincipal userPrincipal)
        Generates a Gravatar URL for the specified principal. If the principal does not have an email address or the email address does not have a Gravatar, will fallback to using the mystery-man image.
        Parameters:
        userPrincipal - the user principal to generate a Gravatar URL from
        Returns:
        a Gravatar URL for the specified principal
        Since:
        1.0.0
      • getGravatarUrl

        public static String getGravatarUrl​(UserPrincipal userPrincipal,
                                            int size)
        Generates a Gravatar URL for the specified principal. If the principal does not have an email address or the email address does not have a Gravatar, will fallback to using the mystery-man image.
        Parameters:
        userPrincipal - the user principal to generate a Gravatar URL from
        size - the size of the image
        Returns:
        a Gravatar URL for the specified principal
        Since:
        1.0.0
      • getGravatarUrl

        public static String getGravatarUrl​(String emailAddress)
        Generates a Gravatar URL for the specified email address. If the email address is blank or does not have a Gravatar, will fallback to usingthe mystery-man image.
        Parameters:
        emailAddress - the email address to generate the Gravatar URL from
        Returns:
        a Gravatar URL for the specified email address
        Since:
        1.0.0
      • getGravatarUrl

        public static String getGravatarUrl​(String emailAddress,
                                            int size)
        Generates a Gravatar URL for the specified email address. If the email address is blank or does not have a Gravatar, will fallback to usingthe mystery-man image.
        Parameters:
        emailAddress - the email address to generate the Gravatar URL from
        size - the size of the image
        Returns:
        a Gravatar URL for the specified email address
        Since:
        1.0.0