public abstract class UserAvatarResolver extends Object implements ExtensionPoint
This is an extension point of Jenkins. Plugins that contribute a new implementation
of this class should put Extension
on your implementation class, like this:
@Extension
class MyUserAvatarResolver extends UserAvatarResolver
{
...
}
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
UserAvatarResolver() |
Modifier and Type | Method and Description |
---|---|
static ExtensionList<UserAvatarResolver> |
all()
Returns all the registered
UserAvatarResolver descriptors. |
abstract String |
findAvatarFor(User u,
int width,
int height)
Finds an avatar image URL string for a user.
|
static String |
resolve(User u,
String avatarSize)
Resolve an avatar image URL string for the user.
|
static String |
resolveOrNull(User u,
String avatarSize)
Like
resolve(hudson.model.User, java.lang.String) but returns null rather than a fallback URL in case there is no special avatar. |
public abstract String findAvatarFor(User u, int width, int height)
This method is called when a web page is going to show an avatar for a User
.
When multiple resolvers are installed, they are consulted in order and the search will be over when an avatar is found by someone.
Since UserAvatarResolver
is singleton, this method can be invoked concurrently
from multiple threads.
u
- the userwidth
- the preferred width of the avatarheight
- the preferred height of the avatar.public static String resolve(User u, String avatarSize)
resolveOrNull(hudson.model.User, java.lang.String)
.u
- useravatarSize
- the preferred image size, "[width]x[height]"@CheckForNull public static String resolveOrNull(User u, String avatarSize)
resolve(hudson.model.User, java.lang.String)
but returns null rather than a fallback URL in case there is no special avatar.public static ExtensionList<UserAvatarResolver> all()
UserAvatarResolver
descriptors.Copyright © 2004–2019. All rights reserved.