166 |
168 |
167 /** |
169 /** |
168 * Sets the permissions component of this builder. On return, the |
170 * Sets the permissions component of this builder. On return, the |
169 * permissions component of this builder is a copy of the given set. |
171 * permissions component of this builder is a copy of the given set. |
170 * |
172 * |
|
173 * @param perms the permissions component |
171 * @return this builder |
174 * @return this builder |
172 * |
175 * |
173 * @throws ClassCastException |
176 * @throws ClassCastException |
174 * if the set contains elements that are not of type {@code |
177 * if the set contains elements that are not of type {@code |
175 * AclEntryPermission} |
178 * AclEntryPermission} |
191 /** |
194 /** |
192 * Sets the permissions component of this builder. On return, the |
195 * Sets the permissions component of this builder. On return, the |
193 * permissions component of this builder is a copy of the permissions in |
196 * permissions component of this builder is a copy of the permissions in |
194 * the given array. |
197 * the given array. |
195 * |
198 * |
|
199 * @param perms the permissions component |
196 * @return this builder |
200 * @return this builder |
197 */ |
201 */ |
198 public Builder setPermissions(AclEntryPermission... perms) { |
202 public Builder setPermissions(AclEntryPermission... perms) { |
199 Set<AclEntryPermission> set = EnumSet.noneOf(AclEntryPermission.class); |
203 Set<AclEntryPermission> set = EnumSet.noneOf(AclEntryPermission.class); |
200 // copy and check for null elements |
204 // copy and check for null elements |
209 |
213 |
210 /** |
214 /** |
211 * Sets the flags component of this builder. On return, the flags |
215 * Sets the flags component of this builder. On return, the flags |
212 * component of this builder is a copy of the given set. |
216 * component of this builder is a copy of the given set. |
213 * |
217 * |
|
218 * @param flags the flags component |
214 * @return this builder |
219 * @return this builder |
215 * |
220 * |
216 * @throws ClassCastException |
221 * @throws ClassCastException |
217 * if the set contains elements that are not of type {@code |
222 * if the set contains elements that are not of type {@code |
218 * AclEntryFlag} |
223 * AclEntryFlag} |
234 /** |
239 /** |
235 * Sets the flags component of this builder. On return, the flags |
240 * Sets the flags component of this builder. On return, the flags |
236 * component of this builder is a copy of the flags in the given |
241 * component of this builder is a copy of the flags in the given |
237 * array. |
242 * array. |
238 * |
243 * |
|
244 * @param flags the flags component |
239 * @return this builder |
245 * @return this builder |
240 */ |
246 */ |
241 public Builder setFlags(AclEntryFlag... flags) { |
247 public Builder setFlags(AclEntryFlag... flags) { |
242 Set<AclEntryFlag> set = EnumSet.noneOf(AclEntryFlag.class); |
248 Set<AclEntryFlag> set = EnumSet.noneOf(AclEntryFlag.class); |
243 // copy and check for null elements |
249 // copy and check for null elements |
265 } |
271 } |
266 |
272 |
267 /** |
273 /** |
268 * Constructs a new builder with the components of an existing ACL entry. |
274 * Constructs a new builder with the components of an existing ACL entry. |
269 * |
275 * |
270 * @param entry |
276 * @param entry an ACL entry |
271 * an ACL entry |
|
272 * |
|
273 * @return a new builder |
277 * @return a new builder |
274 */ |
278 */ |
275 public static Builder newBuilder(AclEntry entry) { |
279 public static Builder newBuilder(AclEntry entry) { |
276 return new Builder(entry.type, entry.who, entry.perms, entry.flags); |
280 return new Builder(entry.type, entry.who, entry.perms, entry.flags); |
277 } |
281 } |
278 |
282 |
279 /** |
283 /** |
280 * Returns the ACL entry type. |
284 * Returns the ACL entry type. |
|
285 * |
|
286 * @return the ACL entry type |
281 */ |
287 */ |
282 public AclEntryType type() { |
288 public AclEntryType type() { |
283 return type; |
289 return type; |
284 } |
290 } |
285 |
291 |
286 /** |
292 /** |
287 * Returns the principal component. |
293 * Returns the principal component. |
|
294 * |
|
295 * @return the principal component |
288 */ |
296 */ |
289 public UserPrincipal principal() { |
297 public UserPrincipal principal() { |
290 return who; |
298 return who; |
291 } |
299 } |
292 |
300 |
293 /** |
301 /** |
294 * Returns a copy of the permissions component. |
302 * Returns a copy of the permissions component. |
295 * |
303 * |
296 * <p> The returned set is a modifiable copy of the permissions. |
304 * <p> The returned set is a modifiable copy of the permissions. |
|
305 * |
|
306 * @return the permissions component |
297 */ |
307 */ |
298 public Set<AclEntryPermission> permissions() { |
308 public Set<AclEntryPermission> permissions() { |
299 return new HashSet<AclEntryPermission>(perms); |
309 return new HashSet<AclEntryPermission>(perms); |
300 } |
310 } |
301 |
311 |
302 /** |
312 /** |
303 * Returns a copy of the flags component. |
313 * Returns a copy of the flags component. |
304 * |
314 * |
305 * <p> The returned set is a modifiable copy of the flags. |
315 * <p> The returned set is a modifiable copy of the flags. |
|
316 * |
|
317 * @return the flags component |
306 */ |
318 */ |
307 public Set<AclEntryFlag> flags() { |
319 public Set<AclEntryFlag> flags() { |
308 return new HashSet<AclEntryFlag>(flags); |
320 return new HashSet<AclEntryFlag>(flags); |
309 } |
321 } |
310 |
322 |