File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\Extension.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2010, Sun Microsystems, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson;
25
26 import jenkins.YesNoMaybe;
27 import net.java.sezpoz.Indexable;
28
29 import java.lang.annotation.Documented;
30 import java.lang.annotation.Retention;
31 import java.lang.annotation.Target;
32
33 import static java.lang.annotation.ElementType.*;
34 import static java.lang.annotation.RetentionPolicy.RUNTIME;
35 import static jenkins.YesNoMaybe.MAYBE;
36
37 /**
38 * Marks a field, a method, or a class for automatic discovery, so that Hudson can locate
39 * implementations of {@link ExtensionPoint}s automatically.
40 *
41 * <p>
42 * (In contrast, in earlier Hudson, the registration was manual.)
43 *
44 * <p>
45 * In a simplest case, put this on your class, and Hudson will create an instance of it
46 * and register it to the appropriate {@link ExtensionList}.
47 *
48 * <p>
49 * If you'd like Hudson to call
50 * a factory method instead of a constructor, put this annotation on your static factory
51 * method. Hudson will invoke it and if the method returns a non-null instance, it'll be
52 * registered. The return type of the method is used to determine which {@link ExtensionList}
53 * will get the instance.
54 *
55 * Finally, you can put this annotation on a static field if the field contains a reference
56 * to an instance that you'd like to register.
57 *
58 * <p>
59 * This is the default way of having your implementations auto-registered to Hudson,
60 * but Hudson also supports arbitrary DI containers for hosting your implementations.
61 * See {@link ExtensionFinder} for more details.
62 *
63 * @author Kohsuke Kawaguchi
64 * @since 1.286
65 * @see <a href="http://sezpoz.java.net/">SezPoz</a>
66 * @see ExtensionFinder
67 * @see ExtensionList
68 */
69 @Indexable
70 @Retention(RUNTIME)
71 @Target({TYPE, FIELD, METHOD})
72 @Documented
73 public @interface Extension {
74 /**
75 * Used for sorting extensions.
76 *
77 * Extensions will be sorted in the descending order of the ordinal.
78 * This is a rather poor approach to the problem, so its use is generally discouraged.
79 *
80 * @since 1.306
81 */
82 double ordinal() default 0;
83
84 /**
85 * If an extension is optional, don't log any class loading errors when reading it.
86 * @since 1.358
87 */
88 boolean optional() default false;
89
90 /**
91 * Marks whether this extension works with dynamic loading of a plugin.
92 *
93 * <p>
94 * "Yes" indicates an explicit sign-off from the developer indicating this component supports that.
95 * Similarly, "No" indicates that this extension is known not to support it, which forces Jenkins
96 * not to offer dynamic loading as an option.
97 *
98 * <p>
99 * The "MayBe" value indicates that there's no such explicit sign-off. So the dynamic loading may or may not
100 * work.
101 *
102 * <p>
103 * If your plugin contains any extension that has dynamic loadability set to NO, then Jenkins
104 * will prompt the user to restart Jenkins to have the plugin take effect. If every component
105 * is marked as YES, then Jenkins will simply dynamic load the plugin without asking the user.
106 * Otherwise, Jenkins will ask the user if he wants to restart, or go ahead and dynamically deploy.
107 *
108 * @since 1.442
109 */
110 YesNoMaybe dynamicLoadable() default MAYBE;
111 }
112