KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > classfile > ConstBasic


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer.classfile;
26
27 import java.io.*;
28
29 /**
30  * Abstract base class of the types which represent entries in
31  * the class constant pool.
32  */

33
34 abstract public class ConstBasic implements VMConstants {
35   /* The index of the constant entry in the constant pool */
36   protected int index = 0;
37
38   /* public accessors */
39
40   /* Get the index of this constant entry */
41   public int getIndex() { return index; }
42
43   /* Return the type of the constant entry - see VMConstants */
44   public abstract int tag ();
45
46   /* package local methods */
47
48   /**
49    * Sets the index of this constant with its containing constant pool
50    */

51   void setIndex(int ind) { index = ind; }
52
53   /**
54    * Write this Constant pool entry to the output stream
55    */

56   abstract void formatData (DataOutputStream b) throws IOException;
57
58   /**
59    * Resolve integer index references to the actual constant pool
60    * entries that they represent. This is used during class file
61    * reading because a constant pool entry could have a forward
62    * reference to a higher numbered constant.
63    */

64   abstract void resolve (ConstantPool p);
65
66   /**
67    * Return the index of this constant in the constant pool as
68    * a decimal formatted String.
69    */

70   String JavaDoc indexAsString() { return Integer.toString(index); }
71
72   /**
73    * The constructor for subtypes
74    */

75   ConstBasic () {}
76 }
77
78
Popular Tags