1 // Modifier.java - Process modifier values.
3 /* Copyright (C) 1998, 1999 Cygnus Solutions
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
12 * @author Tom Tromey <tromey@cygnus.com>
13 * @date October 1, 1998
16 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
17 * "The Java Language Specification", ISBN 0-201-63451-1
18 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
19 * Status: Believed complete and correct to version 1.1
22 package java.lang.reflect;
26 public static final int PUBLIC = 0x001;
27 public static final int PRIVATE = 0x002;
28 public static final int PROTECTED = 0x004;
29 public static final int STATIC = 0x008;
30 public static final int FINAL = 0x010;
31 public static final int SYNCHRONIZED = 0x020;
32 public static final int VOLATILE = 0x040;
33 public static final int TRANSIENT = 0x080;
34 public static final int NATIVE = 0x100;
35 public static final int INTERFACE = 0x200;
36 public static final int ABSTRACT = 0x400;
38 public static boolean isAbstract (int mod)
40 return (mod & ABSTRACT) != 0;
43 public static boolean isFinal (int mod)
45 return (mod & FINAL) != 0;
48 public static boolean isInterface (int mod)
50 return (mod & INTERFACE) != 0;
53 public static boolean isNative (int mod)
55 return (mod & NATIVE) != 0;
58 public static boolean isPrivate (int mod)
60 return (mod & PRIVATE) != 0;
63 public static boolean isProtected (int mod)
65 return (mod & PROTECTED) != 0;
68 public static boolean isPublic (int mod)
70 return (mod & PUBLIC) != 0;
73 public static boolean isStatic (int mod)
75 return (mod & STATIC) != 0;
78 public static boolean isSynchronized (int mod)
80 return (mod & SYNCHRONIZED) != 0;
83 public static boolean isTransient (int mod)
85 return (mod & TRANSIENT) != 0;
88 public static boolean isVolatile (int mod)
90 return (mod & VOLATILE) != 0;
93 public static String toString (int mod)
95 StringBuffer r = new StringBuffer ();
100 static void toString (int mod, StringBuffer r)
104 if (isProtected (mod))
105 r.append("protected ");
107 r.append("private ");
108 if (isAbstract (mod))
109 r.append("abstract ");
114 if (isTransient (mod))
115 r.append("transient ");
116 if (isVolatile (mod))
117 r.append("volatile ");
120 if (isSynchronized (mod))
121 r.append("synchronized ");
122 if (isInterface (mod))
123 r.append("interface ");
125 // Trim trailing space.