KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > proguard > classfile > LibraryMember


1 /*
2  * ProGuard -- shrinking, optimization, obfuscation, and preverification
3  * of Java bytecode.
4  *
5  * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
6  *
7  * This library 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 library 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 Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21 package proguard.classfile;
22
23 import proguard.classfile.visitor.*;
24 import proguard.classfile.attribute.*;
25 import proguard.classfile.constant.*;
26
27 import java.io.*;
28
29 /**
30  * Representation of a field or method from a library class.
31  *
32  * @author Eric Lafortune
33  */

34 public abstract class LibraryMember implements Member
35 {
36     private static final int ACC_VISIBLE = ClassConstants.INTERNAL_ACC_PUBLIC |
37                                            ClassConstants.INTERNAL_ACC_PROTECTED;
38
39
40     public int u2accessFlags;
41     public String JavaDoc name;
42     public String JavaDoc descriptor;
43
44     /**
45      * An extra field in which visitors can store information.
46      */

47     public Object JavaDoc visitorInfo;
48
49
50     protected LibraryMember() {}
51
52
53     /**
54      * Accepts the given member info visitor.
55      */

56     public abstract void accept(LibraryClass libraryClass,
57                                 MemberVisitor memberVisitor);
58
59
60     // Implementations for Member.
61

62     public int getAccessFlags()
63     {
64         return u2accessFlags;
65     }
66
67     public String JavaDoc getName(Clazz clazz)
68     {
69         return name;
70     }
71
72     public String JavaDoc getDescriptor(Clazz clazz)
73     {
74         return descriptor;
75     }
76
77     public void accept(Clazz clazz, MemberVisitor memberVisitor)
78     {
79         accept((LibraryClass)clazz, memberVisitor);
80     }
81
82
83     // Implementations for VisitorAccepter.
84

85     public Object JavaDoc getVisitorInfo()
86     {
87         return visitorInfo;
88     }
89
90     public void setVisitorInfo(Object JavaDoc visitorInfo)
91     {
92         this.visitorInfo = visitorInfo;
93     }
94 }
95
Popular Tags