public class ClassFileConstants
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassFileConstants.ConstantSet
Stores constant values from a class file.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) static byte |
bb
A byte value for testing.
|
(package private) static char |
c
A char value for testing.
|
(package private) static double |
d
A double value for testing.
|
(package private) static float |
f
A float value for testing.
|
(package private) static int |
ii
An int value for testing.
|
(package private) static long |
ll
A long value for testing.
|
(package private) static short |
s
A short value for testing.
|
| Constructor and Description |
|---|
ClassFileConstants() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addToConstantMap(ClassFileConstants.ConstantSet cs,
MultiMap<java.lang.Class<?>,NonreceiverTerm> map)
Add all constant values from the given ConstantSet as NonreceiverTerms to their corresponding
class in the given map.
|
static java.util.Set<NonreceiverTerm> |
constantSetToNonreceiverTerms(ClassFileConstants.ConstantSet cs)
Convert a ConstantSet to a set of NonreceiverTerms.
|
static ClassFileConstants.ConstantSet |
getConstants(java.lang.String classname)
Returns all the constants found in the given class.
|
static ClassFileConstants.ConstantSet |
getConstants(java.lang.String classname,
ClassFileConstants.ConstantSet result)
Adds all the constants found in the given class into the given ConstantSet, and returns it.
|
static java.util.Set<NonreceiverTerm> |
getNonreceiverTerms(java.lang.Class<?> c)
Return the set of NonreceiverTerms converted from constants for the given class.
|
static void |
main(java.lang.String[] args)
A simple driver program that prints output literals file format.
|
(package private) static void |
registerClassConstant(java.lang.Class<?> value,
ClassFileConstants.ConstantSet cs)
Register a Class constant in the given ConstantSet.
|
(package private) static void |
registerConstant(org.apache.bcel.classfile.Constant constant,
org.apache.bcel.classfile.ConstantPool constant_pool,
ClassFileConstants.ConstantSet cs)
Register a constant in the given ConstantSet.
|
(package private) static void |
registerDoubleConstant(java.lang.Double value,
ClassFileConstants.ConstantSet cs)
Register a double constant in the given ConstantSet.
|
(package private) static void |
registerFloatConstant(java.lang.Float value,
ClassFileConstants.ConstantSet cs)
Register a float constant in the given ConstantSet.
|
(package private) static void |
registerIntegerConstant(java.lang.Integer value,
ClassFileConstants.ConstantSet cs)
Register an integer constant in the given ConstantSet.
|
(package private) static void |
registerLongConstant(java.lang.Long value,
ClassFileConstants.ConstantSet cs)
Register a long constant in the given ConstantSet.
|
(package private) static void |
registerStringConstant(java.lang.String value,
ClassFileConstants.ConstantSet cs)
Register a String constant in the given ConstantSet.
|
static MultiMap<java.lang.Class<?>,NonreceiverTerm> |
toMap(java.util.Collection<ClassFileConstants.ConstantSet> constantSets)
Convert a collection of ConstantSets to the format expected by GenTest.addClassLiterals.
|
static byte bb
static double d
static float f
static int ii
static long ll
static short s
static char c
public static void main(java.lang.String[] args)
throws java.io.IOException
args - the command line argumentsjava.io.IOException - if an error occurs in writing the constantsLiteralFileReaderpublic static ClassFileConstants.ConstantSet getConstants(java.lang.String classname)
classname - the name of the typegetConstants(String,ConstantSet)public static ClassFileConstants.ConstantSet getConstants(java.lang.String classname, ClassFileConstants.ConstantSet result)
classname - the name of the typeresult - the set of constants to which constants are addedgetConstants(String)static void registerConstant(org.apache.bcel.classfile.Constant constant,
org.apache.bcel.classfile.ConstantPool constant_pool,
ClassFileConstants.ConstantSet cs)
constant - the constantconstant_pool - a constant pool that is used if the constant is a String, Class, or Enumcs - the ConstantSetstatic void registerDoubleConstant(java.lang.Double value,
ClassFileConstants.ConstantSet cs)
value - the double constantcs - the ConstantSetstatic void registerFloatConstant(java.lang.Float value,
ClassFileConstants.ConstantSet cs)
value - the float constantcs - the ConstantSetstatic void registerIntegerConstant(java.lang.Integer value,
ClassFileConstants.ConstantSet cs)
value - the integer constantcs - the ConstantSetstatic void registerLongConstant(java.lang.Long value,
ClassFileConstants.ConstantSet cs)
value - the long constantcs - the ConstantSetstatic void registerStringConstant(java.lang.String value,
ClassFileConstants.ConstantSet cs)
value - the String constantcs - the ConstantSetstatic void registerClassConstant(java.lang.Class<?> value,
ClassFileConstants.ConstantSet cs)
value - the Class constantcs - the ConstantSetpublic static java.util.Set<NonreceiverTerm> getNonreceiverTerms(java.lang.Class<?> c)
c - the classpublic static MultiMap<java.lang.Class<?>,NonreceiverTerm> toMap(java.util.Collection<ClassFileConstants.ConstantSet> constantSets)
constantSets - the sets of constantSetsprivate static void addToConstantMap(ClassFileConstants.ConstantSet cs, MultiMap<java.lang.Class<?>,NonreceiverTerm> map)
cs - the constant setmap - the map to add topublic static java.util.Set<NonreceiverTerm> constantSetToNonreceiverTerms(ClassFileConstants.ConstantSet cs)
cs - the ConstantSet