Package org.apache.bcel.classfile
Class Constant
- java.lang.Object
-
- org.apache.bcel.classfile.Constant
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Node
- 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 386056 2006-03-15 11:31:56Z tcurdt $
- Author:
- M. Dahm
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte
tag
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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)
boolean
equals(java.lang.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)
java.lang.String
toString()
-
-
-
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.
-
dump
public abstract void dump(java.io.DataOutputStream file) throws java.io.IOException
- Throws:
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 classjava.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 classjava.lang.Object
- Throws:
java.lang.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(java.lang.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 classjava.lang.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 classjava.lang.Object
- See Also:
Object.hashCode()
-
-