286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/Apackage com.sun.org.apache.bcel.internal.classfile;
286N/A
286N/A/* ====================================================================
286N/A * The Apache Software License, Version 1.1
286N/A *
286N/A * Copyright (c) 2001 The Apache Software Foundation. All rights
286N/A * reserved.
286N/A *
286N/A * Redistribution and use in source and binary forms, with or without
286N/A * modification, are permitted provided that the following conditions
286N/A * are met:
286N/A *
286N/A * 1. Redistributions of source code must retain the above copyright
286N/A * notice, this list of conditions and the following disclaimer.
286N/A *
286N/A * 2. Redistributions in binary form must reproduce the above copyright
286N/A * notice, this list of conditions and the following disclaimer in
286N/A * the documentation and/or other materials provided with the
286N/A * distribution.
286N/A *
286N/A * 3. The end-user documentation included with the redistribution,
286N/A * if any, must include the following acknowledgment:
286N/A * "This product includes software developed by the
286N/A * Apache Software Foundation (http://www.apache.org/)."
286N/A * Alternately, this acknowledgment may appear in the software itself,
286N/A * if and wherever such third-party acknowledgments normally appear.
286N/A *
286N/A * 4. The names "Apache" and "Apache Software Foundation" and
286N/A * "Apache BCEL" must not be used to endorse or promote products
286N/A * derived from this software without prior written permission. For
286N/A * written permission, please contact apache@apache.org.
286N/A *
286N/A * 5. Products derived from this software may not be called "Apache",
286N/A * "Apache BCEL", nor may "Apache" appear in their name, without
286N/A * prior written permission of the Apache Software Foundation.
286N/A *
286N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
286N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
286N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
286N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
286N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
286N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
286N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
286N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
286N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
286N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
286N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
286N/A * SUCH DAMAGE.
286N/A * ====================================================================
286N/A *
286N/A * This software consists of voluntary contributions made by many
286N/A * individuals on behalf of the Apache Software Foundation. For more
286N/A * information on the Apache Software Foundation, please see
286N/A * <http://www.apache.org/>.
286N/A */
286N/A
286N/Aimport com.sun.org.apache.bcel.internal.Constants;
286N/A
286N/A/**
286N/A * Super class for all objects that have modifiers like private, final, ...
286N/A * I.e. classes, fields, and methods.
286N/A *
286N/A * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
286N/A */
286N/Apublic abstract class AccessFlags implements java.io.Serializable {
286N/A protected int access_flags;
286N/A
286N/A public AccessFlags() {}
286N/A
286N/A /**
286N/A * @param a inital access flags
286N/A */
286N/A public AccessFlags(int a) {
286N/A access_flags = a;
286N/A }
286N/A
286N/A /**
286N/A * @return Access flags of the object aka. "modifiers".
286N/A */
286N/A public final int getAccessFlags() { return access_flags; }
286N/A
286N/A /**
286N/A * @return Access flags of the object aka. "modifiers".
286N/A */
286N/A public final int getModifiers() { return access_flags; }
286N/A
286N/A /** Set access flags aka "modifiers".
286N/A * @param access_flags Access flags of the object.
286N/A */
286N/A public final void setAccessFlags(int access_flags) {
286N/A this.access_flags = access_flags;
286N/A }
286N/A
286N/A /** Set access flags aka "modifiers".
286N/A * @param access_flags Access flags of the object.
286N/A */
286N/A public final void setModifiers(int access_flags) {
286N/A setAccessFlags(access_flags);
286N/A }
286N/A
286N/A private final void setFlag(int flag, boolean set) {
286N/A if((access_flags & flag) != 0) { // Flag is set already
286N/A if(!set) // Delete flag ?
286N/A access_flags ^= flag;
286N/A } else { // Flag not set
286N/A if(set) // Set flag ?
286N/A access_flags |= flag;
286N/A }
286N/A }
286N/A
286N/A public final void isPublic(boolean flag) { setFlag(Constants.ACC_PUBLIC, flag); }
286N/A public final boolean isPublic() {
286N/A return (access_flags & Constants.ACC_PUBLIC) != 0;
286N/A }
286N/A
286N/A public final void isPrivate(boolean flag) { setFlag(Constants.ACC_PRIVATE, flag); }
286N/A public final boolean isPrivate() {
286N/A return (access_flags & Constants.ACC_PRIVATE) != 0;
286N/A }
286N/A
286N/A public final void isProtected(boolean flag) { setFlag(Constants.ACC_PROTECTED, flag); }
286N/A public final boolean isProtected() {
286N/A return (access_flags & Constants.ACC_PROTECTED) != 0;
286N/A }
286N/A
286N/A public final void isStatic(boolean flag) { setFlag(Constants.ACC_STATIC, flag); }
286N/A public final boolean isStatic() {
286N/A return (access_flags & Constants.ACC_STATIC) != 0;
286N/A }
286N/A
286N/A public final void isFinal(boolean flag) { setFlag(Constants.ACC_FINAL, flag); }
286N/A public final boolean isFinal() {
286N/A return (access_flags & Constants.ACC_FINAL) != 0;
286N/A }
286N/A
286N/A public final void isSynchronized(boolean flag) { setFlag(Constants.ACC_SYNCHRONIZED, flag); }
286N/A public final boolean isSynchronized() {
286N/A return (access_flags & Constants.ACC_SYNCHRONIZED) != 0;
286N/A }
286N/A
286N/A public final void isVolatile(boolean flag) { setFlag(Constants.ACC_VOLATILE, flag); }
286N/A public final boolean isVolatile() {
286N/A return (access_flags & Constants.ACC_VOLATILE) != 0;
286N/A }
286N/A
286N/A public final void isTransient(boolean flag) { setFlag(Constants.ACC_TRANSIENT, flag); }
286N/A public final boolean isTransient() {
286N/A return (access_flags & Constants.ACC_TRANSIENT) != 0;
286N/A }
286N/A
286N/A public final void isNative(boolean flag) { setFlag(Constants.ACC_NATIVE, flag); }
286N/A public final boolean isNative() {
286N/A return (access_flags & Constants.ACC_NATIVE) != 0;
286N/A }
286N/A
286N/A public final void isInterface(boolean flag) { setFlag(Constants.ACC_INTERFACE, flag); }
286N/A public final boolean isInterface() {
286N/A return (access_flags & Constants.ACC_INTERFACE) != 0;
286N/A }
286N/A
286N/A public final void isAbstract(boolean flag) { setFlag(Constants.ACC_ABSTRACT, flag); }
286N/A public final boolean isAbstract() {
286N/A return (access_flags & Constants.ACC_ABSTRACT) != 0;
286N/A }
286N/A
286N/A public final void isStrictfp(boolean flag) { setFlag(Constants.ACC_STRICT, flag); }
286N/A public final boolean isStrictfp() {
286N/A return (access_flags & Constants.ACC_STRICT) != 0;
286N/A }
286N/A}