|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.bripkens.gravatar.Gravatar
public class Gravatar
A utility class for the generation of Gravatar URLs. This class supports various settings, e.g. default image, custom default image and avatar ratings that are meant to simplify the URL generation process. A Gravatar instance can be used multiple times and the getUrl(...) method is thread safe. Example:
String gravatarImageURL = new Gravatar()
.setSize(50)
.setHttps(true)
.setRating(Rating.PARENTAL_GUIDANCE_SUGGESTED)
.setStandardDefaultImage(DefaultImage.MONSTER)
.getUrl("foobar@example.com");
| Field Summary | |
|---|---|
static Rating |
DEFAULT_RATING
|
static int |
DEFAULT_SIZE
|
static String |
FILE_TYPE_EXTENSION
|
static String |
HTTPS_URL
|
static String |
URL
|
| Constructor Summary | |
|---|---|
Gravatar()
|
|
| Method Summary | |
|---|---|
String |
getUrl(String email)
Retrieve the gravatar URL for the given email. |
Gravatar |
setCustomDefaultImage(String customDefaultImage)
Set the default image which will be retrieved when there is no avatar for the given email, when the avatar can't be shown due to the rating or when you enforce the default avatar. |
Gravatar |
setCustomDefaultImage(String customDefaultImage,
String encoding)
Set the default image which will be retrieved when there is no avatar for the given email, when the avatar can't be shown due to the rating or when you enforce the default avatar. |
Gravatar |
setForceDefault(boolean forceDefault)
Enforce usage of the default image by passing true. |
Gravatar |
setHttps(boolean https)
Retrieve an avatar URL which allows retrieval over HTTPS. |
Gravatar |
setRating(Rating rating)
Restrict the retrieved avatars to the ones appropriate for the audience. |
Gravatar |
setSize(int size)
Set the desired size through the size property. |
Gravatar |
setStandardDefaultImage(DefaultImage standardDefaultImage)
Set the default image which will be retrieved when there is no avatar for the given email, when the avatar can't be shown due to the rating or when you enforce the default avatar. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String URL
public static final String HTTPS_URL
public static final String FILE_TYPE_EXTENSION
public static final int DEFAULT_SIZE
public static final Rating DEFAULT_RATING
| Constructor Detail |
|---|
public Gravatar()
| Method Detail |
|---|
public Gravatar setSize(int size)
size - The avatar size in pixel.
public Gravatar setHttps(boolean https)
https - Set to true to retrieve a HTTPS URL.
public Gravatar setForceDefault(boolean forceDefault)
forceDefault - True to always retrieve the default image.
public Gravatar setRating(Rating rating)
rating - This rating will be allowed.
public Gravatar setStandardDefaultImage(DefaultImage standardDefaultImage)
standardDefaultImage - One of multiple default avatar choices.
public Gravatar setCustomDefaultImage(String customDefaultImage)
throws UnsupportedEncodingException
customDefaultImage - Absolute URL to an image. An UTF-8 encoding
is expected.
UnsupportedEncodingException
public Gravatar setCustomDefaultImage(String customDefaultImage,
String encoding)
throws UnsupportedEncodingException
customDefaultImage - Absolute URL to an image.encoding - customDefaultImage's (first parameter) encoding
UnsupportedEncodingExceptionURLEncoder.encode(String, String)public String getUrl(String email)
email - The email for which the avatar URL should be returned.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||