@Retention(value=RUNTIME) @Target(value={TYPE,FIELD,METHOD}) @Documented public @interface Extension
ExtensionPoint
s automatically.
(In contrast, in earlier Hudson, the registration was manual.)
In a simplest case, put this on your class, and Hudson will create an instance of it
and register it to the appropriate ExtensionList
.
If you'd like Hudson to call
a factory method instead of a constructor, put this annotation on your static factory
method. Hudson will invoke it and if the method returns a non-null instance, it'll be
registered. The return type of the method is used to determine which ExtensionList
will get the instance.
Finally, you can put this annotation on a static field if the field contains a reference
to an instance that you'd like to register.
This is the default way of having your implementations auto-registered to Hudson,
but Hudson also supports arbitrary DI containers for hosting your implementations.
See ExtensionFinder
for more details.
ExtensionFinder
,
ExtensionList
Modifier and Type | Optional Element and Description |
---|---|
YesNoMaybe |
dynamicLoadable
Marks whether this extension works with dynamic loading of a plugin.
|
boolean |
optional
If an extension is optional, don't log any class loading errors when reading it.
|
double |
ordinal
Used for sorting extensions.
|
public abstract double ordinal
public abstract boolean optional
public abstract YesNoMaybe dynamicLoadable
"Yes" indicates an explicit sign-off from the developer indicating this component supports that. Similarly, "No" indicates that this extension is known not to support it, which forces Jenkins not to offer dynamic loading as an option.
The "MayBe" value indicates that there's no such explicit sign-off. So the dynamic loading may or may not work.
If your plugin contains any extension that has dynamic loadability set to NO, then Jenkins will prompt the user to restart Jenkins to have the plugin take effect. If every component is marked as YES, then Jenkins will simply dynamic load the plugin without asking the user. Otherwise, Jenkins will ask the user if he wants to restart, or go ahead and dynamically deploy.
Copyright © 2004–2021. All rights reserved.