~ubuntu-branches/ubuntu/wily/aspectj/wily-proposed

« back to all changes in this revision

Viewing changes to org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/StandardAnnotation.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-03-15 23:54:31 UTC
  • mfrom: (1.1.5 upstream) (7.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110315235431-7d8cs3gvs4tnqx7t
Tags: 1.6.11+dfsg-1
* New upstream release.
* Updated Standards-Version to 3.9.1 (no changes needed).
* Fix local Javadoc links:
  - d/patches/07_javadoc_links.diff: Use locally installed
   javadoc packages and hyperlink with them.
  - d/control: Add B-D on default-java-doc and libasm3-java-doc.
* d/control: Drop B-D on itself (our new bootstrap infrastructure doesn't need
  that anymore).
* Split packages into :
  - aspectj: only contains CLI tools.
  - libaspectj-java: JAR librairies for /usr/share/java.
  - libaspectj-java-doc: 4 API's Javadoc.
  - aspectj-doc: Programming Guides and SDK Documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
        private final boolean isRuntimeVisible;
29
29
 
30
 
        private List /* of AnnotationNVPair */nvPairs = null;
 
30
        private List<AnnotationNameValuePair> nvPairs = null;
31
31
 
32
32
        public StandardAnnotation(ResolvedType type, boolean isRuntimeVisible) {
33
33
                super(type);
49
49
                sb.append("@").append(type.getClassName());
50
50
                if (hasNameValuePairs()) {
51
51
                        sb.append("(");
52
 
                        for (Iterator iter = nvPairs.iterator(); iter.hasNext();) {
53
 
                                AnnotationNameValuePair element = (AnnotationNameValuePair) iter.next();
54
 
                                sb.append(element.stringify());
 
52
                        for (AnnotationNameValuePair nvPair : nvPairs) {
 
53
                                sb.append(nvPair.stringify());
55
54
                        }
56
55
                        sb.append(")");
57
56
                }
60
59
 
61
60
        public String toString() {
62
61
                StringBuffer sb = new StringBuffer();
63
 
                sb.append("ANNOTATION [" + getTypeSignature() + "] [" + (isRuntimeVisible ? "runtimeVisible" : "runtimeInvisible") + "] [");
 
62
                sb.append("Anno[" + getTypeSignature() + " " + (isRuntimeVisible ? "rVis" : "rInvis"));
64
63
                if (nvPairs != null) {
65
 
                        for (Iterator iter = nvPairs.iterator(); iter.hasNext();) {
66
 
                                AnnotationNameValuePair element = (AnnotationNameValuePair) iter.next();
 
64
                        sb.append(" ");
 
65
                        for (Iterator<AnnotationNameValuePair> iter = nvPairs.iterator(); iter.hasNext();) {
 
66
                                AnnotationNameValuePair element = iter.next();
67
67
                                sb.append(element.toString());
68
 
                                if (iter.hasNext())
 
68
                                if (iter.hasNext()) {
69
69
                                        sb.append(",");
 
70
                                }
70
71
                        }
71
72
                }
72
73
                sb.append("]");
77
78
         * {@inheritDoc}
78
79
         */
79
80
        public boolean hasNamedValue(String n) {
80
 
                if (nvPairs == null)
 
81
                if (nvPairs == null) {
81
82
                        return false;
 
83
                }
82
84
                for (int i = 0; i < nvPairs.size(); i++) {
83
 
                        AnnotationNameValuePair pair = (AnnotationNameValuePair) nvPairs.get(i);
84
 
                        if (pair.getName().equals(n))
 
85
                        AnnotationNameValuePair pair = nvPairs.get(i);
 
86
                        if (pair.getName().equals(n)) {
85
87
                                return true;
 
88
                        }
86
89
                }
87
90
                return false;
88
91
        }
91
94
         * {@inheritDoc}
92
95
         */
93
96
        public boolean hasNameValuePair(String n, String v) {
94
 
                if (nvPairs == null)
 
97
                if (nvPairs == null) {
95
98
                        return false;
 
99
                }
96
100
                for (int i = 0; i < nvPairs.size(); i++) {
97
 
                        AnnotationNameValuePair pair = (AnnotationNameValuePair) nvPairs.get(i);
 
101
                        AnnotationNameValuePair pair = nvPairs.get(i);
98
102
                        if (pair.getName().equals(n)) {
99
 
                                if (pair.getValue().stringify().equals(v))
 
103
                                if (pair.getValue().stringify().equals(v)) {
100
104
                                        return true;
 
105
                                }
101
106
                        }
102
107
                }
103
108
                return false;
106
111
        /**
107
112
         * {@inheritDoc}
108
113
         */
109
 
        public Set /* <String> */getTargets() {
 
114
        public Set<String> getTargets() {
110
115
                if (!type.equals(UnresolvedType.AT_TARGET)) {
111
 
                        return Collections.EMPTY_SET;
 
116
                        return Collections.emptySet();
112
117
                }
113
 
                AnnotationNameValuePair nvp = (AnnotationNameValuePair) nvPairs.get(0);
 
118
                AnnotationNameValuePair nvp = nvPairs.get(0);
114
119
                ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue();
115
120
                AnnotationValue[] avs = aav.getValues();
116
 
                Set targets = new HashSet();
 
121
                Set<String> targets = new HashSet<String>();
117
122
                for (int i = 0; i < avs.length; i++) {
118
123
                        AnnotationValue value = avs[i];
119
124
                        targets.add(value.stringify());
121
126
                return targets;
122
127
        }
123
128
 
124
 
        public List getNameValuePairs() {
 
129
        public List<AnnotationNameValuePair> getNameValuePairs() {
125
130
                return nvPairs;
126
131
        }
127
132
 
131
136
 
132
137
        public void addNameValuePair(AnnotationNameValuePair pair) {
133
138
                if (nvPairs == null) {
134
 
                        nvPairs = new ArrayList();
 
139
                        nvPairs = new ArrayList<AnnotationNameValuePair>();
135
140
                }
136
141
                nvPairs.add(pair);
137
142
        }
141
146
         */
142
147
        public String getStringFormOfValue(String name) {
143
148
                if (hasNameValuePairs()) {
144
 
                        for (Iterator iterator = nvPairs.iterator(); iterator.hasNext();) {
145
 
                                AnnotationNameValuePair nvPair = (AnnotationNameValuePair) iterator.next();
 
149
                        for (AnnotationNameValuePair nvPair : nvPairs) {
146
150
                                if (nvPair.getName().equals(name)) {
147
151
                                        return nvPair.getValue().stringify();
148
152
                                }