Package alpine.util
Class GravatarUtil
- java.lang.Object
-
- alpine.util.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgenerateHash(String emailAddress)Generates a hash value from the specified email address.static StringgetGravatarUrl(UserPrincipal userPrincipal)Generates a Gravatar URL for the specified principal.static StringgetGravatarUrl(UserPrincipal userPrincipal, int size)Generates a Gravatar URL for the specified principal.static StringgetGravatarUrl(String emailAddress)Generates a Gravatar URL for the specified email address.static StringgetGravatarUrl(String emailAddress, int size)Generates a Gravatar URL for the specified email address.
-
-
-
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 fromsize- 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 fromsize- the size of the image- Returns:
- a Gravatar URL for the specified email address
- Since:
- 1.0.0
-
-