提交 6b7d75f1 编写于 作者: K Kohsuke Kawaguchi

allow extensions to mark if it supports dynamic loading or not

上级 0c54ef47
......@@ -23,6 +23,7 @@
*/
package hudson;
import jenkins.YesNoMaybe;
import net.java.sezpoz.Indexable;
import java.lang.annotation.Documented;
......@@ -31,6 +32,7 @@ import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static jenkins.YesNoMaybe.MAYBE;
/**
* Marks a field, a method, or a class for automatic discovery, so that Hudson can locate
......@@ -84,4 +86,20 @@ public @interface Extension {
* @since 1.358
*/
boolean optional() default false;
/**
* Marks whether this extension works with dynamic loading of a plugin.
*
* <p>
* "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.
*
* <p>
* The "MayBe" value indicates that there's no such explicit sign-off. So the dynamic loading may or may not
* work.
*
* @since 1.DynamicExtensionFinder
*/
YesNoMaybe dynamicLoadable() default MAYBE;
}
/*
* The MIT License
*
* Copyright (c) 2011, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package jenkins;
/**
* Enum that represents {@link Boolean} state (including null for the absence.)
*
* <p>
* This is for situations where we can't use {@link Boolean}, such as annotation elements.
*
* @author Kohsuke Kawaguchi
*/
public enum YesNoMaybe {
YES,
NO,
MAYBE;
public static Boolean toBoolean(YesNoMaybe v) {
if (v==null) return null;
return v.toBool();
}
public Boolean toBool() {
switch (this) {
case YES:
return true;
case NO:
return false;
default:
return null;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册