KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > classfmt > MethodInfoWithParameterAnnotations


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 BEA Systems, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * tyeung@bea.com - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.compiler.classfmt;
12
13 import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
14
15 class MethodInfoWithParameterAnnotations extends MethodInfoWithAnnotations {
16     private AnnotationInfo[][] parameterAnnotations;
17
18 MethodInfoWithParameterAnnotations(MethodInfo methodInfo, AnnotationInfo[] annotations, AnnotationInfo[][] parameterAnnotations) {
19     super(methodInfo, annotations);
20     this.parameterAnnotations = parameterAnnotations;
21 }
22
23 public IBinaryAnnotation[] getParameterAnnotations(int index) {
24     return this.parameterAnnotations[index];
25 }
26 protected void initialize() {
27     for (int i = 0, l = this.parameterAnnotations == null ? 0 : this.parameterAnnotations.length; i < l; i++) {
28         AnnotationInfo[] infos = this.parameterAnnotations[i];
29         for (int j = 0, k = infos == null ? 0 : infos.length; j < k; j++)
30             infos[j].initialize();
31     }
32     super.initialize();
33 }
34 protected void reset() {
35     for (int i = 0, l = this.parameterAnnotations == null ? 0 : this.parameterAnnotations.length; i < l; i++) {
36         AnnotationInfo[] infos = this.parameterAnnotations[i];
37         for (int j = 0, k = infos == null ? 0 : infos.length; j < k; j++)
38             infos[j].reset();
39     }
40     super.reset();
41 }
42 protected void toStringContent(StringBuffer JavaDoc buffer) {
43     super.toStringContent(buffer);
44     for (int i = 0, l = this.parameterAnnotations == null ? 0 : this.parameterAnnotations.length; i < l; i++) {
45         buffer.append("param" + (i - 1)); //$NON-NLS-1$
46
buffer.append('\n');
47         AnnotationInfo[] infos = this.parameterAnnotations[i];
48         for (int j = 0, k = infos == null ? 0 : infos.length; j < k; j++) {
49             buffer.append(infos[j]);
50             buffer.append('\n');
51         }
52     }
53 }
54 }
55
Popular Tags