## org.apache.bcel.classfile
Class Constant

    java.lang.Object
      |
      +--org.apache.bcel.classfile.Constant

All Implemented Interfaces:
  java.lang.Cloneable, Node, java.io.Serializable

Direct Known Subclasses:
  ConstantClass, ConstantCP, ConstantDouble, ConstantFloat, ConstantInteger, ConstantLong, ConstantNameAndType, ConstantString, ConstantUtf8

public abstract class Constant
extends java.lang.Object
implements java.lang.Cloneable, Node, java.io.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
See Also:
  Serialized Form

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.
`java.lang.Object` `clone()`
`Constant` `copy()`
`abstract void` `dump(java.io.DataOutputStream file)`
`byte` `getTag()`
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### tag

    protected byte tag

Method Detail

### 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

### dump

    public abstract void dump(java.io.DataOutputStream file)
                       throws java.io.IOException

    `java.io.IOException`

### getTag

    public final byte getTag()

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

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    String representation.

### copy

    public Constant copy()

  Returns:
    deep copy of this constant

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Overrides:
    `clone` in class `java.lang.Object`
    `java.lang.CloneNotSupportedException`

Copyright © 2002-2003 Apache Software Foundation. All Rights Reserved.