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

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Daniel Dyer
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.model;
25
26 /**
27 * {@link Descriptor} for {@link UserProperty}.
28 *
29 * @author Kohsuke Kawaguchi
30 */
31 public abstract class UserPropertyDescriptor extends Descriptor<UserProperty> {
32 protected UserPropertyDescriptor(Class<? extends UserProperty> clazz) {
33 super(clazz);
34 }
35
36 /**
37 * Infers the type of the corresponding {@link Describable} from the outer class.
38 * This version works when you follow the common convention, where a descriptor
39 * is written as the static nested class of the describable class.
40 *
41 * @since 1.278
42 */
43 protected UserPropertyDescriptor() {
44 }
45
46 /**
47 * Creates a default instance of {@link UserProperty} to be associated
48 * with {@link User} object that wasn't created from a persisted XML data.
49 *
50 * <p>
51 * See {@link User} class javadoc for more details about the life cycle
52 * of {@link User} and when this method is invoked.
53 *
54 * @return null
55 * if the implementation choose not to add any property object for such user.
56 */
57 public abstract UserProperty newInstance(User user);
58
59 /**
60 * Whether or not the described property is enabled in the current context.
61 * Defaults to true. Over-ride in sub-classes as required.
62 *
63 * <p>
64 * Returning false from this method essentially has the same effect of
65 * making Hudson behaves as if this {@link UserPropertyDescriptor} is
66 * not a part of {@link UserProperty#all()}.
67 *
68 * <p>
69 * This mechanism is useful if the availability of the property is
70 * contingent of some other settings.
71 */
72 public boolean isEnabled() {
73 return true;
74 }
75 }
76