Class CredentialsSelectHelper.ContextResolver
java.lang.Object
com.cloudbees.plugins.credentials.CredentialsSelectHelper.ContextResolver
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
CredentialsSelectHelper.ItemContextResolver
,CredentialsSelectHelper.SystemContextResolver
,CredentialsSelectHelper.UserContextResolver
- Enclosing class:
- CredentialsSelectHelper
public abstract static class CredentialsSelectHelper.ContextResolver
extends Object
implements ExtensionPoint
An extension point to allow plugging in additional resolution of
ModelObject
instances.- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CredentialsSelectHelper.ContextResolver
ACredentialsSelectHelper.ContextResolver
that can be used as a marker. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns a human readable description of the type of context objects that the specified resolver resolves.abstract ModelObject
getContext
(String token) Maps a token fromgetToken(ModelObject)
back to its originalModelObject
.abstract String
Returns a human readable description of the type of context objects that this resolver resolves.abstract String
getToken
(ModelObject context) Maps a context object (aModelObject
) into a token that can be used to recover the context.
-
Field Details
-
NONE
ACredentialsSelectHelper.ContextResolver
that can be used as a marker.- Since:
- 2.1.1
-
-
Constructor Details
-
ContextResolver
public ContextResolver()
-
-
Method Details
-
getToken
Maps a context object (aModelObject
) into a token that can be used to recover the context.- Parameters:
context
- theModelObject
.- Returns:
- a token if this
CredentialsSelectHelper.ContextResolver
can recover the object ornull
if theModelObject
type is not supported by thisCredentialsSelectHelper.ContextResolver
.
-
getContext
Maps a token fromgetToken(ModelObject)
back to its originalModelObject
.- Parameters:
token
- the token.- Returns:
- the corresponding
ModelObject
ornull
if the object no longer exists or if the user does not have permission to access that object.
-
getDisplayName
Returns a human readable description of the type of context objects that this resolver resolves.- Returns:
- a human readable description of the type of context objects that this resolver resolves.
- Throws:
AbstractMethodError
- if somebody compiled against pre-2.1.1 implementations. UsedisplayName(CredentialsSelectHelper.ContextResolver)
if you would prefer not to have to catch them.- Since:
- 2.1.1
-
displayName
Returns a human readable description of the type of context objects that the specified resolver resolves.- Parameters:
resolver
- the context resolver to get the display name of.- Returns:
- a human readable description of the type of context objects that the specified resolver resolves.
- Since:
- 2.1.1
-