|
1 /* |
|
2 * ==================================================================== |
|
3 * |
|
4 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
5 * contributor license agreements. See the NOTICE file distributed with |
|
6 * this work for additional information regarding copyright ownership. |
|
7 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
8 * (the "License"); you may not use this file except in compliance with |
|
9 * the License. You may obtain a copy of the License at |
|
10 * |
|
11 * http://www.apache.org/licenses/LICENSE-2.0 |
|
12 * |
|
13 * Unless required by applicable law or agreed to in writing, software |
|
14 * distributed under the License is distributed on an "AS IS" BASIS, |
|
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16 * See the License for the specific language governing permissions and |
|
17 * limitations under the License. |
|
18 * ==================================================================== |
|
19 * |
|
20 * This software consists of voluntary contributions made by many |
|
21 * individuals on behalf of the Apache Software Foundation. For more |
|
22 * information on the Apache Software Foundation, please see |
|
23 * <http://www.apache.org/>. |
|
24 * |
|
25 */ |
|
26 package ch.boye.httpclientandroidlib.annotation; |
|
27 |
|
28 import java.lang.annotation.Documented; |
|
29 import java.lang.annotation.ElementType; |
|
30 import java.lang.annotation.Retention; |
|
31 import java.lang.annotation.RetentionPolicy; |
|
32 import java.lang.annotation.Target; |
|
33 |
|
34 /** |
|
35 * The field or method to which this annotation is applied can only be accessed |
|
36 * when holding a particular lock, which may be a built-in (synchronization) lock, |
|
37 * or may be an explicit java.util.concurrent.Lock. |
|
38 * |
|
39 * The argument determines which lock guards the annotated field or method: |
|
40 * <ul> |
|
41 * <li> |
|
42 * <code>this</code> : The intrinsic lock of the object in whose class the field is defined. |
|
43 * </li> |
|
44 * <li> |
|
45 * <code>class-name.this</code> : For inner classes, it may be necessary to disambiguate 'this'; |
|
46 * the <em>class-name.this</em> designation allows you to specify which 'this' reference is intended |
|
47 * </li> |
|
48 * <li> |
|
49 * <code>itself</code> : For reference fields only; the object to which the field refers. |
|
50 * </li> |
|
51 * <li> |
|
52 * <code>field-name</code> : The lock object is referenced by the (instance or static) field |
|
53 * specified by <em>field-name</em>. |
|
54 * </li> |
|
55 * <li> |
|
56 * <code>class-name.field-name</code> : The lock object is reference by the static field specified |
|
57 * by <em>class-name.field-name</em>. |
|
58 * </li> |
|
59 * <li> |
|
60 * <code>method-name()</code> : The lock object is returned by calling the named nil-ary method. |
|
61 * </li> |
|
62 * <li> |
|
63 * <code>class-name.class</code> : The Class object for the specified class should be used as the lock object. |
|
64 * </li> |
|
65 * <p> |
|
66 * Based on code developed by Brian Goetz and Tim Peierls and concepts |
|
67 * published in 'Java Concurrency in Practice' by Brian Goetz, Tim Peierls, |
|
68 * Joshua Bloch, Joseph Bowbeer, David Holmes and Doug Lea. |
|
69 */ |
|
70 @Documented |
|
71 @Target({ElementType.FIELD, ElementType.METHOD}) |
|
72 @Retention(RetentionPolicy.CLASS) // The original version used RUNTIME |
|
73 public @interface GuardedBy { |
|
74 String value(); |
|
75 } |