org.apache.bcel.classfile

Class Constant

Implemented Interfaces:
Cloneable, Node, Serializable
Known Direct Subclasses:
ConstantClass, ConstantCP, ConstantDouble, ConstantFloat, ConstantInteger, ConstantLong, ConstantNameAndType, ConstantString, ConstantUtf8

public abstract class Constant
extends java.lang.Object
implements Cloneable, Node, Serializable

Abstract superclass for classes to represent the different constant types in the constant pool of a class file. The classes keep closely to the JVM specification.
Version:
$Id: Constant.java,v 1.3 2002/07/11 19:39:04 mdahm Exp $
Author:
M. Dahm

Field Summary

protected byte
tag

Method Summary

abstract void
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
Object
clone()
Constant
copy()
abstract void
dump(DataOutputStream file)
byte
getTag()
String
toString()

Field Details

tag

protected byte tag

Method Details

accept

public abstract void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
Specified by:
accept in interface Node
Parameters:
v - Visitor object

clone

public Object clone()
            throws CloneNotSupportedException

copy

public Constant copy()
Returns:
deep copy of this constant

dump

public abstract void dump(DataOutputStream file)
            throws IOException

getTag

public final byte getTag()
Returns:
Tag of constant, i.e., its type. No setTag() method to avoid confusion.

toString

public String toString()
Returns:
String representation.