|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.util.AlternativeUiTextProvider
public abstract class AlternativeUiTextProvider
Provides the alternative text to be rendered in the UI.
In a few limited places in Jenkins, we want to provide an ability for plugins to replace the text to be shown in the UI. Since each such case is rather trivial and can't justify its own extension point, we consolidate all such use cases into a single extension point.
Each such overridable UI text can have a context, which represents some information
that enables the AlternativeUiTextProvider
to make intelligent decision. This
is normally some kind of a model object, such as AbstractProject
.
To define a new UI text that can be overridable by AlternativeUiTextProvider
,
define a constant of AlternativeUiTextProvider.Message
(parameterized with the context object type),
then call get(Message, Object)
to obtain a text.
To define an implementation that overrides text, define a subtype and put @Extension
on it.
See AbstractProject.getBuildNowText()
as an example.
Nested Class Summary | |
---|---|
static class |
AlternativeUiTextProvider.Message<T>
Each instance of this class represents a text that can be replaced by AlternativeUiTextProvider . |
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Constructor Summary | |
---|---|
AlternativeUiTextProvider()
|
Method Summary | ||
---|---|---|
static ExtensionList<AlternativeUiTextProvider> |
all()
All the registered extension point instances. |
|
static
|
get(AlternativeUiTextProvider.Message<T> text,
T context)
Consults all the existing AlternativeUiTextProvider and return an override, if any,
or null. |
|
static
|
get(AlternativeUiTextProvider.Message<T> text,
T context,
String defaultValue)
|
|
abstract
|
getText(AlternativeUiTextProvider.Message<T> text,
T context)
Provides an opportunity to override the message text. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AlternativeUiTextProvider()
Method Detail |
---|
public abstract <T> String getText(AlternativeUiTextProvider.Message<T> text, T context)
text
- Always non-null. Caller should pass in a AlternativeUiTextProvider.Message
constant that
represents the text that we are being considered.context
- Context object. See class javadoc above.public static ExtensionList<AlternativeUiTextProvider> all()
public static <T> String get(AlternativeUiTextProvider.Message<T> text, T context, String defaultValue)
public static <T> String get(AlternativeUiTextProvider.Message<T> text, T context)
AlternativeUiTextProvider
and return an override, if any,
or null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |