KickJava   Java API By Example, From Geeks To Geeks.

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


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 public final class FieldInfoWithAnnotation extends FieldInfo {
14     private AnnotationInfo[] annotations;
15
16 FieldInfoWithAnnotation(FieldInfo info, AnnotationInfo[] annos) {
17     super(info.reference, info.constantPoolOffsets, info.structOffset);
18     this.accessFlags = info.accessFlags;
19     this.attributeBytes = info.attributeBytes;
20     this.constant = info.constant;
21     this.constantPoolOffsets = info.constantPoolOffsets;
22     this.descriptor = info.descriptor;
23     this.name = info.name;
24     this.signature = info.signature;
25     this.signatureUtf8Offset = info.signatureUtf8Offset;
26     this.tagBits = info.tagBits;
27     this.wrappedConstantValue = info.wrappedConstantValue;
28     this.annotations = annos;
29 }
30 public org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation[] getAnnotations() {
31     return this.annotations;
32 }
33 protected void initialize() {
34     for (int i = 0, max = this.annotations.length; i < max; i++)
35         this.annotations[i].initialize();
36     super.initialize();
37 }
38 protected void reset() {
39     if (annotations != null)
40         for (int i = 0, max = this.annotations.length; i < max; i++)
41             this.annotations[i].reset();
42     super.reset();
43 }
44 public String JavaDoc toString() {
45     StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(this.getClass().getName());
46     if (this.annotations != null) {
47         buffer.append('\n');
48         for (int i = 0; i < this.annotations.length; i++) {
49             buffer.append(this.annotations[i]);
50             buffer.append('\n');
51         }
52     }
53     toStringContent(buffer);
54     return buffer.toString();
55 }
56 }
57
Popular Tags