Source Code Cross Referenced for Access.java in  » Scripting » Nice » gnu » bytecode » 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 » Scripting » Nice » gnu.bytecode 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright (c) 1997  Per M.A. Bothner.
002:        // This is free software;  for terms and warranty disclaimer see ./COPYING.
003:
004:        package gnu.bytecode;
005:
006:        import java.io.*;
007:
008:        /** Access flags. */
009:        /* When using JDK 1.1, replace this class by java.lang.reflec.Modifiers. */
010:
011:        public class Access {
012:            static public final short PUBLIC = 0x0001;
013:            static public final short PRIVATE = 0x0002;
014:            static public final short PROTECTED = 0x0004;
015:            static public final short STATIC = 0x0008;
016:            static public final short FINAL = 0x0010;
017:            static public final short SUPER = 0x0020;
018:            static public final short SYNCHRONIZED = 0x0020;
019:            static public final short VOLATILE = 0x0040;
020:            static public final short TRANSIENT = 0x0080;
021:            static public final short NATIVE = 0x0100;
022:            static public final short INTERFACE = 0x0200;
023:            static public final short ABSTRACT = 0x0400;
024:
025:            public static String toString(int flags) {
026:                StringBuffer buf = new StringBuffer();
027:                if ((flags & PUBLIC) != 0)
028:                    buf.append(" public");
029:                if ((flags & PRIVATE) != 0)
030:                    buf.append(" private");
031:                if ((flags & PROTECTED) != 0)
032:                    buf.append(" protected");
033:                if ((flags & STATIC) != 0)
034:                    buf.append(" static");
035:                if ((flags & FINAL) != 0)
036:                    buf.append(" final");
037:                if ((flags & SYNCHRONIZED) != 0)
038:                    buf.append(" synchronized");
039:                if ((flags & VOLATILE) != 0)
040:                    buf.append(" volatile");
041:                if ((flags & TRANSIENT) != 0)
042:                    buf.append(" transient");
043:                if ((flags & NATIVE) != 0)
044:                    buf.append(" native");
045:                if ((flags & INTERFACE) != 0)
046:                    buf.append(" interface");
047:                if ((flags & ABSTRACT) != 0)
048:                    buf.append(" abstract");
049:                int unknown = flags
050:                        & ~(PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL
051:                                | SYNCHRONIZED | VOLATILE | NATIVE | INTERFACE | ABSTRACT);
052:                if (unknown != 0) {
053:                    buf.append(" 0x");
054:                    buf.append(Integer.toHexString(unknown));
055:                }
056:                return buf.toString();
057:            }
058:
059:            /**
060:               @return true if code in class c can access method m, with the first
061:               argument of the call being receiver.
062:
063:               receiver is null if the call is static.
064:             */
065:            public static boolean legal(ClassType c, Method m, Type receiver) {
066:                int mod = m.getModifiers();
067:                if ((mod & PUBLIC) != 0)
068:                    return true;
069:
070:                ClassType target = m.getDeclaringClass();
071:
072:                if ((mod & PRIVATE) != 0)
073:                    return c == target;
074:
075:                // clone is the only method overriden for arrays, where it is public.
076:                // (JLS-2 10.7)
077:                if (receiver != null && receiver.isArray()
078:                        && m.getName().equals("clone"))
079:                    return true;
080:
081:                // DEFAULT (PACKAGE) OR PROTECTED
082:                if (c.getPackageName().equals(target.getPackageName()))
083:                    return true;
084:
085:                // PROTECTED
086:                return (mod & PROTECTED) != 0 && c.isSubclass(target)
087:                        && receiver.isSubtype(c);
088:            }
089:
090:            /***
091:             * Returns true if classType is legally accessible in the given package.
092:             */
093:            public static boolean legal(ClassType classType, String packageName) {
094:                int mod = classType.getModifiers();
095:
096:                if ((mod & PUBLIC) != 0)
097:                    return true;
098:
099:                if ((mod & PRIVATE) != 0)
100:                    return false;
101:
102:                if (!packageName.equals(classType.getPackageName()))
103:                    return false;
104:
105:                return true;
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.