85 * @since 9
86 */
87 MODULE_SOURCE_PATH,
88
89 /**
90 * Location to search for upgradeable system modules.
91 * @since 9
92 */
93 UPGRADE_MODULE_PATH,
94
95 /**
96 * Location to search for system modules.
97 * @since 9
98 */
99 SYSTEM_MODULES,
100
101 /**
102 * Location to search for precompiled user modules.
103 * @since 9
104 */
105 MODULE_PATH;
106
107 /**
108 * Returns a location object with the given name. The following
109 * property must hold: {@code locationFor(x) ==
110 * locationFor(y)} if and only if {@code x.equals(y)}.
111 * The returned location will be an output location if and only if
112 * name ends with {@code "_OUTPUT"}. It will be considered to
113 * be a module-oriented location if the name contains the word
114 * {@code "MODULE"}.
115 *
116 * @param name a name
117 * @return a location
118 */
119 public static Location locationFor(final String name) {
120 if (locations.isEmpty()) {
121 // can't use valueOf which throws IllegalArgumentException
122 for (Location location : values())
123 locations.putIfAbsent(location.getName(), location);
124 }
125 name.getClass(); /* null-check */
141 @Override
142 public boolean isOutputLocation() {
143 switch (this) {
144 case CLASS_OUTPUT:
145 case SOURCE_OUTPUT:
146 case NATIVE_HEADER_OUTPUT:
147 return true;
148 default:
149 return false;
150 }
151 }
152
153 @Override
154 public boolean isModuleOrientedLocation() {
155 switch (this) {
156 case MODULE_SOURCE_PATH:
157 case ANNOTATION_PROCESSOR_MODULE_PATH:
158 case UPGRADE_MODULE_PATH:
159 case SYSTEM_MODULES:
160 case MODULE_PATH:
161 return true;
162 default:
163 return false;
164 }
165 }
166 }
|
85 * @since 9
86 */
87 MODULE_SOURCE_PATH,
88
89 /**
90 * Location to search for upgradeable system modules.
91 * @since 9
92 */
93 UPGRADE_MODULE_PATH,
94
95 /**
96 * Location to search for system modules.
97 * @since 9
98 */
99 SYSTEM_MODULES,
100
101 /**
102 * Location to search for precompiled user modules.
103 * @since 9
104 */
105 MODULE_PATH,
106
107 /**
108 * Location to search for module patches.
109 * @since 9
110 * @spec JPMS
111 */
112 PATCH_MODULE_PATH;
113
114 /**
115 * Returns a location object with the given name. The following
116 * property must hold: {@code locationFor(x) ==
117 * locationFor(y)} if and only if {@code x.equals(y)}.
118 * The returned location will be an output location if and only if
119 * name ends with {@code "_OUTPUT"}. It will be considered to
120 * be a module-oriented location if the name contains the word
121 * {@code "MODULE"}.
122 *
123 * @param name a name
124 * @return a location
125 */
126 public static Location locationFor(final String name) {
127 if (locations.isEmpty()) {
128 // can't use valueOf which throws IllegalArgumentException
129 for (Location location : values())
130 locations.putIfAbsent(location.getName(), location);
131 }
132 name.getClass(); /* null-check */
148 @Override
149 public boolean isOutputLocation() {
150 switch (this) {
151 case CLASS_OUTPUT:
152 case SOURCE_OUTPUT:
153 case NATIVE_HEADER_OUTPUT:
154 return true;
155 default:
156 return false;
157 }
158 }
159
160 @Override
161 public boolean isModuleOrientedLocation() {
162 switch (this) {
163 case MODULE_SOURCE_PATH:
164 case ANNOTATION_PROCESSOR_MODULE_PATH:
165 case UPGRADE_MODULE_PATH:
166 case SYSTEM_MODULES:
167 case MODULE_PATH:
168 case PATCH_MODULE_PATH:
169 return true;
170 default:
171 return false;
172 }
173 }
174 }
|