Source Code Cross Referenced for ProgramMember.java in  » Development » proguard » proguard » classfile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » proguard » proguard.classfile 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ProGuard -- shrinking, optimization, obfuscation, and preverification
003:         *             of Java bytecode.
004:         *
005:         * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
006:         *
007:         * This library is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License as published by the Free
009:         * Software Foundation; either version 2 of the License, or (at your option)
010:         * any later version.
011:         *
012:         * This library is distributed in the hope that it will be useful, but WITHOUT
013:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014:         * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
015:         * for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public License
018:         * along with this library; if not, write to the Free Software Foundation,
019:         * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         */
021:        package proguard.classfile;
022:
023:        import proguard.classfile.attribute.*;
024:        import proguard.classfile.attribute.visitor.AttributeVisitor;
025:        import proguard.classfile.visitor.MemberVisitor;
026:
027:        /**
028:         * Representation of a field or method from a program class.
029:         *
030:         * @author Eric Lafortune
031:         */
032:        public abstract class ProgramMember implements  Member {
033:            public int u2accessFlags;
034:            public int u2nameIndex;
035:            public int u2descriptorIndex;
036:            public int u2attributesCount;
037:            public Attribute[] attributes;
038:
039:            /**
040:             * An extra field in which visitors can store information.
041:             */
042:            public Object visitorInfo;
043:
044:            protected ProgramMember() {
045:            }
046:
047:            /**
048:             * Returns the line number range of the given class member as "m:n",
049:             * if it can find it, or <code>null</code> otherwise.
050:             */
051:            public String getLineNumberRange(Clazz clazz) {
052:                CodeAttribute codeAttribute = (CodeAttribute) getAttribute(
053:                        clazz, ClassConstants.ATTR_Code);
054:                if (codeAttribute == null) {
055:                    return null;
056:                }
057:
058:                LineNumberTableAttribute lineNumberTableAttribute = (LineNumberTableAttribute) codeAttribute
059:                        .getAttribute(clazz,
060:                                ClassConstants.ATTR_LineNumberTable);
061:                if (lineNumberTableAttribute == null) {
062:                    return null;
063:                }
064:
065:                return ""
066:                        + lineNumberTableAttribute.getLineNumber(0)
067:                        + ":"
068:                        + lineNumberTableAttribute
069:                                .getLineNumber(Integer.MAX_VALUE);
070:            }
071:
072:            /**
073:             * Returns the (first) attribute with the given name.
074:             */
075:            private Attribute getAttribute(Clazz clazz, String name) {
076:                for (int index = 0; index < u2attributesCount; index++) {
077:                    Attribute attribute = attributes[index];
078:                    if (attribute.getAttributeName(clazz).equals(name)) {
079:                        return attribute;
080:                    }
081:                }
082:
083:                return null;
084:            }
085:
086:            /**
087:             * Accepts the given member info visitor.
088:             */
089:            public abstract void accept(ProgramClass programClass,
090:                    MemberVisitor memberVisitor);
091:
092:            /**
093:             * Lets the given attribute info visitor visit all the attributes of
094:             * this member info.
095:             */
096:            public abstract void attributesAccept(ProgramClass programClass,
097:                    AttributeVisitor attributeVisitor);
098:
099:            // Implementations for Member.
100:
101:            public int getAccessFlags() {
102:                return u2accessFlags;
103:            }
104:
105:            public String getName(Clazz clazz) {
106:                return clazz.getString(u2nameIndex);
107:            }
108:
109:            public String getDescriptor(Clazz clazz) {
110:                return clazz.getString(u2descriptorIndex);
111:            }
112:
113:            public void accept(Clazz clazz, MemberVisitor memberVisitor) {
114:                accept((ProgramClass) clazz, memberVisitor);
115:            }
116:
117:            // Implementations for VisitorAccepter.
118:
119:            public Object getVisitorInfo() {
120:                return visitorInfo;
121:            }
122:
123:            public void setVisitorInfo(Object visitorInfo) {
124:                this.visitorInfo = visitorInfo;
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.