Constant (jakarta-bcel 5.2 API)
Keywords: org.apache.bcel.classfile.Constant class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.bcel.classfile
Class Constant

    java.lang.Object
      org.apache.bcel.classfile.Constant

All Implemented Interfaces:
  Serializable, Cloneable, Node

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

    public abstract class Constant

extends 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 386056 2006-03-15 11:31:56Z tcurdt $
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.
`Object` | `clone()`
`Constant` | `copy()`
`abstract void` | `dump(DataOutputStream file)`
`boolean` | `equals(Object obj)` Return value as defined by given BCELComparator strategy.
`static BCELComparator` | `getComparator()`
`byte` | `getTag()`
`int` | `hashCode()` Return value as defined by given BCELComparator strategy.
`static void` | `setComparator(BCELComparator comparator)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`finalize, getClass, 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(DataOutputStream file)
                       throws IOException

  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()

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

### copy

    public Constant copy()

  Returns:
    deep copy of this constant

### clone

    public Object clone()
                 throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

### getComparator

    public static BCELComparator getComparator()

  Returns:
    Comparison strategy object

### setComparator

    public static void setComparator(BCELComparator comparator)

  Parameters:
    `comparator` - Comparison strategy object

### equals

    public boolean equals(Object obj)

  Return value as defined by given BCELComparator strategy. By default two Constant objects are said to be equal when the result of toString() is equal.

  Overrides:
    `equals` in class `Object`
  See Also:
    `Object.equals(java.lang.Object)`

### hashCode

    public int hashCode()

  Return value as defined by given BCELComparator strategy. By default return the hashcode of the result of toString().

  Overrides:
    `hashCode` in class `Object`
  See Also:
    `Object.hashCode()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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