Line 0
Link Here
|
|
|
1 |
/* |
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 |
* |
4 |
* Copyright 2011 Oracle and/or its affiliates. All rights reserved. |
5 |
* |
6 |
* Oracle and Java are registered trademarks of Oracle and/or its affiliates. |
7 |
* Other names may be trademarks of their respective owners. |
8 |
* |
9 |
* The contents of this file are subject to the terms of either the GNU |
10 |
* General Public License Version 2 only ("GPL") or the Common |
11 |
* Development and Distribution License("CDDL") (collectively, the |
12 |
* "License"). You may not use this file except in compliance with the |
13 |
* License. You can obtain a copy of the License at |
14 |
* http://www.netbeans.org/cddl-gplv2.html |
15 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
16 |
* specific language governing permissions and limitations under the |
17 |
* License. When distributing the software, include this License Header |
18 |
* Notice in each file and include the License file at |
19 |
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this |
20 |
* particular file as subject to the "Classpath" exception as provided |
21 |
* by Oracle in the GPL Version 2 section of the License file that |
22 |
* accompanied this code. If applicable, add the following below the |
23 |
* License Header, with the fields enclosed by brackets [] replaced by |
24 |
* your own identifying information: |
25 |
* "Portions Copyrighted [year] [name of copyright owner]" |
26 |
* |
27 |
* If you wish your version of this file to be governed by only the CDDL |
28 |
* or only the GPL Version 2, indicate your decision by adding |
29 |
* "[Contributor] elects to include this software in this distribution |
30 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a |
31 |
* single choice of license, a recipient has the option to distribute |
32 |
* your version of this file under either the CDDL, the GPL Version 2 or |
33 |
* to extend the choice of license to its licensees as provided above. |
34 |
* However, if you add GPL Version 2 code and therefore, elected the GPL |
35 |
* Version 2 license, then the option applies only if the new code is |
36 |
* made subject to such option by the copyright holder. |
37 |
* |
38 |
* Contributor(s): |
39 |
* |
40 |
* Portions Copyrighted 2011 Sun Microsystems, Inc. |
41 |
*/ |
42 |
package org.netbeans.modules.refactoring.java.api; |
43 |
|
44 |
import org.netbeans.modules.refactoring.api.MoveRefactoring; |
45 |
|
46 |
/** |
47 |
* This class is just holder for properties of the Java Move Members |
48 |
* Refactoring. Refactoring itself is implemented in plugins. |
49 |
* |
50 |
* @see org.netbeans.modules.refactoring.api.MoveRefactoring |
51 |
* @see org.netbeans.modules.refactoring.api.Context |
52 |
* @author Ralph Ruijs |
53 |
* @since 1.31 |
54 |
*/ |
55 |
public final class JavaMoveMembersProperties { |
56 |
|
57 |
private Visibility visibility; |
58 |
private boolean delegate; |
59 |
private boolean addDeprecated; |
60 |
private boolean updateJavaDoc; |
61 |
|
62 |
/** |
63 |
* Constructs a new JavaMoveMembersProperties object. |
64 |
*/ |
65 |
public JavaMoveMembersProperties() { |
66 |
visibility = Visibility.ESCALATE; |
67 |
delegate = false; |
68 |
addDeprecated = false; |
69 |
updateJavaDoc = true; |
70 |
} |
71 |
|
72 |
/** |
73 |
* The new visibility of the members. |
74 |
* |
75 |
* @return visibility |
76 |
*/ |
77 |
public Visibility getVisibility() { |
78 |
return visibility; |
79 |
} |
80 |
|
81 |
/** |
82 |
* The new visibility of the members. |
83 |
* |
84 |
* @param visibility the visibility to use |
85 |
*/ |
86 |
public void setVisibility(Visibility visibility) { |
87 |
this.visibility = visibility; |
88 |
} |
89 |
|
90 |
/** |
91 |
* Leave the old method in place and let it delegate to the new location. |
92 |
* All references to the method will not be touched. |
93 |
* |
94 |
* @return true if the old method will delegate to the new location, false |
95 |
* otherwise |
96 |
*/ |
97 |
public boolean isDelegate() { |
98 |
return delegate; |
99 |
} |
100 |
|
101 |
/** |
102 |
* Leave the old method in place and let it delegate to the new location. |
103 |
* All references to the method will not be touched. |
104 |
* |
105 |
* @param delegate true if the old method needs delegate to the new location |
106 |
*/ |
107 |
public void setDelegate(boolean delegate) { |
108 |
this.delegate = delegate; |
109 |
} |
110 |
|
111 |
/** |
112 |
* Add a deprecated tag to the JavaDoc of the delegating method. |
113 |
* |
114 |
* @return true if a deprecated tag needs to be added, false otherwise |
115 |
*/ |
116 |
public boolean isAddDeprecated() { |
117 |
return addDeprecated; |
118 |
} |
119 |
|
120 |
/** |
121 |
* Add a deprecated tag to the JavaDoc of the delegating method. |
122 |
* |
123 |
* @param addDeprecated true if a deprecated tag has to be added to the |
124 |
* delegate method |
125 |
*/ |
126 |
public void setAddDeprecated(boolean addDeprecated) { |
127 |
this.addDeprecated = addDeprecated; |
128 |
} |
129 |
|
130 |
/** |
131 |
* Update or create the JavaDoc for moved methods. |
132 |
* |
133 |
* @return true if JavaDoc will be created or the existing will be updated, |
134 |
* false otherwise |
135 |
*/ |
136 |
public boolean isUpdateJavaDoc() { |
137 |
return updateJavaDoc; |
138 |
} |
139 |
|
140 |
/** |
141 |
* Add a deprecated tag to the javadoc of the delegating method. |
142 |
* |
143 |
* @param updateJavaDoc true if the method's JavaDoc needs to be created or |
144 |
* updated. |
145 |
*/ |
146 |
public void setUpdateJavaDoc(boolean updateJavaDoc) { |
147 |
this.updateJavaDoc = updateJavaDoc; |
148 |
} |
149 |
|
150 |
/** |
151 |
* Used to specify visibility level. It can either be set explicitly, or set |
152 |
* to Escalate to automatically raise it to a necessary level. |
153 |
*/ |
154 |
public static enum Visibility { |
155 |
|
156 |
/** |
157 |
* Escalate, automatically raise the visibility to a necessary level, |
158 |
* based on usages. |
159 |
*/ |
160 |
ESCALATE, |
161 |
/** |
162 |
* As is, keep the current visibility level of the member. |
163 |
*/ |
164 |
ASIS, |
165 |
/** |
166 |
* Change to, or keep, the visibility public. |
167 |
*/ |
168 |
PUBLIC, |
169 |
/** |
170 |
* Change to, or keep, the visibility protected. |
171 |
*/ |
172 |
PROTECTED, |
173 |
/** |
174 |
* Change to, or keep, the visibility the default level. |
175 |
*/ |
176 |
DEFAULT, |
177 |
/** |
178 |
* Change to, or keep, the visibility private. |
179 |
*/ |
180 |
PRIVATE |
181 |
} |
182 |
} |