aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/Modifier.java
diff options
context:
space:
mode:
authorpatriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-04-22 13:47:06 +0000
committerpatriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-04-22 13:47:06 +0000
commit069bceaf72fd0d6ffad14ce4e3e00ca91a280bde (patch)
treeb8230a15d3061c64d5a64bf9efa654d0d6311ff2 /src/main/javassist/Modifier.java
parentf610083ba0adbcb3fe92a504015fb26fb5a42530 (diff)
downloadjavassist-069bceaf72fd0d6ffad14ce4e3e00ca91a280bde.tar.gz
javassist-069bceaf72fd0d6ffad14ce4e3e00ca91a280bde.zip
This commit was generated by cvs2svn to compensate for changes in r2, which
included commits to RCS files with non-trunk default branches. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@6 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/Modifier.java')
-rw-r--r--src/main/javassist/Modifier.java191
1 files changed, 191 insertions, 0 deletions
diff --git a/src/main/javassist/Modifier.java b/src/main/javassist/Modifier.java
new file mode 100644
index 00000000..e6c7d2c5
--- /dev/null
+++ b/src/main/javassist/Modifier.java
@@ -0,0 +1,191 @@
+/*
+ * This file is part of the Javassist toolkit.
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * either http://www.mozilla.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Javassist.
+ *
+ * The Initial Developer of the Original Code is Shigeru Chiba. Portions
+ * created by Shigeru Chiba are Copyright (C) 1999-2003 Shigeru Chiba.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * The development of this software is supported in part by the PRESTO
+ * program (Sakigake Kenkyu 21) of Japan Science and Technology Corporation.
+ */
+
+package javassist;
+
+import javassist.bytecode.AccessFlag;
+
+/**
+ * The Modifier class provides static methods and constants to decode
+ * class and member access modifiers. The constant values are equivalent
+ * to the corresponding values in <code>javassist.bytecode.AccessFlag</code>.
+ *
+ * <p>All the methods/constants in this class are compatible with
+ * ones in <code>java.lang.reflect.Modifier</code>.
+ *
+ * @see CtClass#getModifiers()
+ */
+public class Modifier {
+ public static final int PUBLIC = AccessFlag.PUBLIC;
+ public static final int PRIVATE = AccessFlag.PRIVATE;
+ public static final int PROTECTED = AccessFlag.PROTECTED;
+ public static final int STATIC = AccessFlag.STATIC;
+ public static final int FINAL = AccessFlag.FINAL;
+ public static final int SYNCHRONIZED = AccessFlag.SYNCHRONIZED;
+ public static final int VOLATILE = AccessFlag.VOLATILE;
+ public static final int TRANSIENT = AccessFlag.TRANSIENT;
+ public static final int NATIVE = AccessFlag.NATIVE;
+ public static final int INTERFACE = AccessFlag.INTERFACE;
+ public static final int ABSTRACT = AccessFlag.ABSTRACT;
+ public static final int STRICT = AccessFlag.STRICT;
+
+ /**
+ * Returns true if the modifiers include the <tt>public</tt>
+ * modifier.
+ */
+ public static boolean isPublic(int mod) {
+ return (mod & PUBLIC) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>private</tt>
+ * modifier.
+ */
+ public static boolean isPrivate(int mod) {
+ return (mod & PRIVATE) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>protected</tt>
+ * modifier.
+ */
+ public static boolean isProtected(int mod) {
+ return (mod & PROTECTED) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>static</tt>
+ * modifier.
+ */
+ public static boolean isStatic(int mod) {
+ return (mod & STATIC) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>final</tt>
+ * modifier.
+ */
+ public static boolean isFinal(int mod) {
+ return (mod & FINAL) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>synchronized</tt>
+ * modifier.
+ */
+ public static boolean isSynchronized(int mod) {
+ return (mod & SYNCHRONIZED) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>volatile</tt>
+ * modifier.
+ */
+ public static boolean isVolatile(int mod) {
+ return (mod & VOLATILE) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>transient</tt>
+ * modifier.
+ */
+ public static boolean isTransient(int mod) {
+ return (mod & TRANSIENT) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>native</tt>
+ * modifier.
+ */
+ public static boolean isNative(int mod) {
+ return (mod & NATIVE) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>interface</tt>
+ * modifier.
+ */
+ public static boolean isInterface(int mod) {
+ return (mod & INTERFACE) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>abstract</tt>
+ * modifier.
+ */
+ public static boolean isAbstract(int mod) {
+ return (mod & ABSTRACT) != 0;
+ }
+
+ /**
+ * Returns true if the modifiers include the <tt>strictfp</tt>
+ * modifier.
+ */
+ public static boolean isStrict(int mod) {
+ return (mod & STRICT) != 0;
+ }
+
+ /**
+ * Truns the public bit on. The protected and private bits are
+ * cleared.
+ */
+ public static int setPublic(int mod) {
+ return (mod & ~(PRIVATE | PROTECTED)) | PUBLIC;
+ }
+
+ /**
+ * Truns the protected bit on. The protected and public bits are
+ * cleared.
+ */
+ public static int setProtected(int mod) {
+ return (mod & ~(PRIVATE | PUBLIC)) | PROTECTED;
+ }
+
+ /**
+ * Truns the private bit on. The protected and private bits are
+ * cleared.
+ */
+ public static int setPrivate(int mod) {
+ return (mod & ~(PROTECTED | PUBLIC)) | PRIVATE;
+ }
+
+ /**
+ * Clears the public, protected, and private bits.
+ */
+ public static int setPackage(int mod) {
+ return (mod & ~(PROTECTED | PUBLIC | PRIVATE));
+ }
+
+ /**
+ * Clears a specified bit in <code>mod</code>.
+ */
+ public static int clear(int mod, int clearBit) {
+ return mod & ~clearBit;
+ }
+
+ public static String toString(int mod) {
+ return java.lang.reflect.Modifier.toString(mod);
+ }
+}