KickJava   Java API By Example, From Geeks To Geeks.

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


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 public class MethodInfoWithAnnotations extends MethodInfo {
16     protected AnnotationInfo[] annotations;
17
18 MethodInfoWithAnnotations(MethodInfo methodInfo, AnnotationInfo[] annotations) {
19     super(methodInfo.reference, methodInfo.constantPoolOffsets, methodInfo.structOffset);
20     this.annotations = annotations;
21
22     this.accessFlags = methodInfo.accessFlags;
23     this.attributeBytes = methodInfo.attributeBytes;
24     this.descriptor = methodInfo.descriptor;
25     this.exceptionNames = methodInfo.exceptionNames;
26     this.name = methodInfo.name;
27     this.signature = methodInfo.signature;
28     this.signatureUtf8Offset = methodInfo.signatureUtf8Offset;
29     this.tagBits = methodInfo.tagBits;
30 }
31 public IBinaryAnnotation[] getAnnotations() {
32     return this.annotations;
33 }
34 protected void initialize() {
35     for (int i = 0, l = this.annotations == null ? 0 : this.annotations.length; i < l; i++)
36         if (this.annotations[i] != null)
37             this.annotations[i].initialize();
38     super.initialize();
39 }
40 protected void reset() {
41     for (int i = 0, l = this.annotations == null ? 0 : this.annotations.length; i < l; i++)
42         if (this.annotations[i] != null)
43             this.annotations[i].reset();
44     super.reset();
45 }
46 protected void toStringContent(StringBuffer JavaDoc buffer) {
47     super.toStringContent(buffer);
48     for (int i = 0, l = this.annotations == null ? 0 : this.annotations.length; i < l; i++) {
49         buffer.append(this.annotations[i]);
50         buffer.append('\n');
51     }
52 }
53 }
54
Popular Tags