Constant.java revision 9f606f95f03a75961498803e24bee6799a7c0885
1/*
2 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3 *             of Java bytecode.
4 *
5 * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21package proguard.classfile.constant;
22
23import proguard.classfile.*;
24import proguard.classfile.constant.visitor.ConstantVisitor;
25
26/**
27 * This abstract class represents an entry in the ConstantPool. Specific types
28 * of entries are subclassed from it.
29 *
30 * @author Eric Lafortune
31 */
32public abstract class Constant implements VisitorAccepter
33{
34    //public int  u1tag;
35    //public byte info[];
36
37    /**
38     * An extra field in which visitors can store information.
39     */
40    public Object visitorInfo;
41
42
43    // Abstract methods to be implemented by extensions.
44
45    /**
46     * Returns the constant pool info tag that specifies the entry type.
47     */
48    public abstract int getTag();
49
50
51    /**
52     * Accepts the given visitor.
53     */
54    public abstract void accept(Clazz clazz, ConstantVisitor constantVisitor);
55
56
57    // Implementations for VisitorAccepter.
58
59    public Object getVisitorInfo()
60    {
61        return visitorInfo;
62    }
63
64    public void setVisitorInfo(Object visitorInfo)
65    {
66        this.visitorInfo = visitorInfo;
67    }
68}
69