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

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, 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.cli.declarative;
25
26 import hudson.cli.CLICommand;
27 import org.jvnet.hudson.annotation_indexer.Indexed;
28 import org.kohsuke.args4j.CmdLineException;
29
30 import java.lang.annotation.Documented;
31 import static java.lang.annotation.ElementType.METHOD;
32 import java.lang.annotation.Retention;
33 import static java.lang.annotation.RetentionPolicy.RUNTIME;
34 import java.lang.annotation.Target;
35
36 /**
37 * Annotates a resolver method that binds a portion of the command line arguments and parameters
38 * to an instance whose {@link CLIMethod} is invoked for the final processing.
39 *
40 * <p>
41 * Hudson uses the return type of the resolver method
42 * to pick the resolver method to use, of all the resolver methods it discovers. That is,
43 * if Hudson is looking to find an instance of type <tt>T</tt> for the current command, it first
44 * looks for the resolver method whose return type is <tt>T</tt>, then it checks for the base type of <tt>T</tt>,
45 * and so on.
46 *
47 * <p>
48 * If the chosen resolver method is an instance method on type <tt>S</tt>, the "parent resolver" is then
49 * located to resolve an instance of type 'S'. This process repeats until a static resolver method is discovered
50 * (since most of Hudson's model objects are anchored to the root {@link jenkins.model.Jenkins} object, normally that would become
51 * the top-most resolver method.)
52 *
53 * <p>
54 * Parameters of the resolver method receives the same parameter/argument injections that {@link CLIMethod}s receive.
55 * Parameters and arguments consumed by the resolver will not be visible to {@link CLIMethod}s.
56 *
57 * <p>
58 * The resolver method shall never return null &mdash; it should instead indicate a failure by throwing
59 * {@link CmdLineException}.
60 *
61 * @author Kohsuke Kawaguchi
62 * @see CLICommand
63 * @since 1.321
64 */
65 @Indexed
66 @Retention(RUNTIME)
67 @Target({METHOD})
68 @Documented
69 public @interface CLIResolver {
70 }
71